Class: OoxmlParser::TableGrid
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::TableGrid
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table/table_grid.rb
Overview
Class for parsing ‘w:tblGrid` object
Instance Attribute Summary collapse
-
#columns ⇒ Array, GridColumn
Array of columns.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(parent: nil) ⇒ TableGrid
constructor
A new instance of TableGrid.
-
#parse(node) ⇒ TableGrid
Parse TableGrid.
Methods inherited from OOXMLDocumentObject
add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ TableGrid
Returns a new instance of TableGrid.
8 9 10 11 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 8 def initialize(parent: nil) @columns = [] @parent = parent end |
Instance Attribute Details
#columns ⇒ Array, GridColumn
Returns array of columns.
6 7 8 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 6 def columns @columns end |
Instance Method Details
#==(other) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 13 def ==(other) @columns.each_with_index do |cur_column, index| return false unless cur_column == other.columns[index] end true end |
#parse(node) ⇒ TableGrid
Parse TableGrid
23 24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 23 def parse(node) node.xpath('*').each do |grid_child| case grid_child.name when 'gridCol' @columns << GridColumn.new(parent: self).parse(grid_child) end end self end |