Class: OoxmlParser::TableColumns
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableColumns
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb
Overview
Class for ‘tableColumns` tag data
Instance Attribute Summary collapse
-
#count ⇒ Integer
readonly
Count of columns.
-
#table_column_array ⇒ Array<TableColumn>
readonly
Array of columns.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#[](key) ⇒ Array, TableColumn
Accessor.
-
#initialize(parent: nil) ⇒ TableColumns
constructor
A new instance of TableColumns.
-
#parse(node) ⇒ TableColumns
Parse Table Columns data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ TableColumns
Returns a new instance of TableColumns.
12 13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb', line 12 def initialize(parent: nil) @table_column_array = [] super end |
Instance Attribute Details
#count ⇒ Integer (readonly)
Returns count of columns.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb', line 8 def count @count end |
#table_column_array ⇒ Array<TableColumn> (readonly)
Returns array of columns.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb', line 10 def table_column_array @table_column_array end |
Instance Method Details
#[](key) ⇒ Array, TableColumn
Returns accessor.
18 19 20 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb', line 18 def [](key) @table_column_array[key] end |
#parse(node) ⇒ TableColumns
Parse Table Columns data
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/table_columns.rb', line 25 def parse(node) node.attributes.each do |key, value| case key when 'count' @count = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'tableColumn' @table_column_array << TableColumn.new(parent: self).parse(node_child) end end self end |