From ddbed161e7b0c988f7ded5f6123cac6d991186dc Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 14 Oct 2012 10:38:41 +0900 Subject: refactor options parsing for dxf --- lib/axlsx/stylesheet/dxf.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/axlsx/stylesheet/dxf.rb b/lib/axlsx/stylesheet/dxf.rb index 1a90d6b2..758b0869 100644 --- a/lib/axlsx/stylesheet/dxf.rb +++ b/lib/axlsx/stylesheet/dxf.rb @@ -3,6 +3,9 @@ module Axlsx # The Dxf class defines an incremental formatting record for use in Styles. The recommended way to manage styles for your workbook is with Styles#add_style # @see Styles#add_style class Dxf + + include Axlsx::OptionsParser + # The order in which the child elements is put in the XML seems to # be important for Excel CHILD_ELEMENTS = [:font, :numFmt, :fill, :alignment, :border, :protection] @@ -42,10 +45,7 @@ module Axlsx # @option options [CellAlignment] alignment # @option options [CellProtection] protection def initialize(options={}) - options.each do |o| - next if o[1].nil? - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end + parse_options options end # @see Dxf#alignment -- cgit v1.2.3