diff options
| author | Randy Morgan <[email protected]> | 2012-10-14 13:20:29 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-10-14 13:20:29 +0900 |
| commit | 25ebea9143c136999bdaeb372fb26d2c070ca730 (patch) | |
| tree | 0916e207715d821d3f4f8de45c9690ca65272633 /lib/axlsx/workbook/worksheet/table_style_info.rb | |
| parent | 93b70a39999ac4d06e43e495f3fd283e9630d9d2 (diff) | |
| download | caxlsx-25ebea9143c136999bdaeb372fb26d2c070ca730.tar.gz caxlsx-25ebea9143c136999bdaeb372fb26d2c070ca730.zip | |
Refactored to use options parser, accessors and serialization attributes
Diffstat (limited to 'lib/axlsx/workbook/worksheet/table_style_info.rb')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/table_style_info.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/axlsx/workbook/worksheet/table_style_info.rb b/lib/axlsx/workbook/worksheet/table_style_info.rb index a9e3d8b7..0e41ea50 100644 --- a/lib/axlsx/workbook/worksheet/table_style_info.rb +++ b/lib/axlsx/workbook/worksheet/table_style_info.rb @@ -3,7 +3,8 @@ module Axlsx # The table style info class manages style attributes for defined tables in # a worksheet class TableStyleInfo - + include Axlsx::OptionsParser + include Axlsx::SerializedAttributes include Axlsx::Accessors # creates a new TableStyleInfo instance # @param [Hash] options @@ -20,13 +21,13 @@ module Axlsx def initialize(options = {}) initialize_defaults @name = 'TableStyleMedium9' - options.each do |k, v| - send("#{k}=", v) if respond_to? "#{k}=" - end + parse_options options end # boolean attributes for this object boolean_attr_accessor :show_first_column, :show_last_column, :show_row_stripes, :show_column_stripes + serializable_attributes :show_first_column, :show_last_column, :show_row_stripes, :show_column_stripes, + :name # Initialize all the values to false as Excel requires them to # explicitly be disabled or all will show. @@ -43,9 +44,7 @@ module Axlsx # @param [String] str the string to contact this objects serialization to. def to_xml_string(str = '') str << '<tableStyleInfo ' - instance_values.each do |key, value| - str << Axlsx::camel(key, false) << "='#{value}' " - end + serialized_attributes str str << '/>' end end |
