summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/options_parser.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-10-14 09:50:49 +0900
committerRandy Morgan <[email protected]>2012-10-14 09:50:49 +0900
commit797a1e5150fc617774fcb8ee2bcce3fddb7ab531 (patch)
tree07d6e953abbb4afba309fb34d2833193358b045c /lib/axlsx/util/options_parser.rb
parent87560296ccb05a4fb21461bc64aead272a5839b7 (diff)
downloadcaxlsx-797a1e5150fc617774fcb8ee2bcce3fddb7ab531.tar.gz
caxlsx-797a1e5150fc617774fcb8ee2bcce3fddb7ab531.zip
Refactored options parse into module and applied it to border_rb
This should be done for all classes that use this same peice of repeated code.
Diffstat (limited to 'lib/axlsx/util/options_parser.rb')
-rw-r--r--lib/axlsx/util/options_parser.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/axlsx/util/options_parser.rb b/lib/axlsx/util/options_parser.rb
new file mode 100644
index 00000000..c4c43fa2
--- /dev/null
+++ b/lib/axlsx/util/options_parser.rb
@@ -0,0 +1,9 @@
+module Axlsx
+ module OptionsParser
+ def parse_options(options={})
+ options.each do |o|
+ self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+ end
+ end
+ end
+end