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) ⇒ True, False
Compare this object to other.
-
#initialize(parent: nil) ⇒ TableGrid
constructor
A new instance of TableGrid.
-
#parse(node) ⇒ TableGrid
Parse TableGrid.
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) ⇒ TableGrid
Returns a new instance of TableGrid.
10 11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 10 def initialize(parent: nil) @columns = [] super end |
Instance Attribute Details
#columns ⇒ Array, GridColumn
Returns array of columns.
8 9 10 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 8 def columns @columns end |
Instance Method Details
#==(other) ⇒ True, False
Compare this object to other
18 19 20 21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 18 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
28 29 30 31 32 33 34 35 36 |
# File 'lib/ooxml_parser/common_parser/common_data/table/table_grid.rb', line 28 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 |