class OoxmlParser::TableGrid

Class for parsing `w:tblGrid` object

Attributes

columns[RW]

@return [Array, GridColumn] array of columns

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/common_parser/common_data/table/table_grid.rb, line 10
def initialize(parent: nil)
  @columns = []
  super
end

Public Instance Methods

==(other) click to toggle source

Compare this object to other @param other [Object] any other object @return [True, False] result of comparision

# 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) click to toggle source

Parse TableGrid @param [Nokogiri::XML:Node] node with TableGrid @return [TableGrid] result of parsing

# 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