Class: OoxmlParser::Table
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Table
- Defined in:
- lib/ooxml_parser/common_parser/common_data/table.rb
Overview
Class for Table data
Instance Attribute Summary collapse
-
#grid ⇒ Object
Returns the value of attribute grid.
-
#number ⇒ Object
Returns the value of attribute number.
-
#properties ⇒ Object
(also: #table_properties)
Returns the value of attribute properties.
-
#rows ⇒ Object
Returns the value of attribute rows.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(rows = [], parent: nil) ⇒ Table
constructor
A new instance of Table.
-
#inspect ⇒ String
Inspect of object for debug means.
-
#parse(node, number = 0, default_table_properties = TableProperties.new) ⇒ Table
Parse Table object.
-
#to_s ⇒ String
Result of convert of object to string.
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(rows = [], parent: nil) ⇒ Table
Returns a new instance of Table.
13 14 15 16 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 13 def initialize(rows = [], parent: nil) @rows = rows super(parent: parent) end |
Instance Attribute Details
#grid ⇒ Object
Returns the value of attribute grid.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 11 def grid @grid end |
#number ⇒ Object
Returns the value of attribute number.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 11 def number @number end |
#properties ⇒ Object Also known as: table_properties
Returns the value of attribute properties.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 11 def properties @properties end |
#rows ⇒ Object
Returns the value of attribute rows.
11 12 13 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 11 def rows @rows end |
Instance Method Details
#inspect ⇒ String
Returns inspect of object for debug means.
26 27 28 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 26 def inspect to_s end |
#parse(node, number = 0, default_table_properties = TableProperties.new) ⇒ Table
Parse Table object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 33 def parse(node, number = 0, default_table_properties = TableProperties.new) table_properties = default_table_properties.dup table_properties.jc = :left node.xpath('*').each do |node_child| case node_child.name when 'tblGrid' @grid = TableGrid.new(parent: self).parse(node_child) when 'tr' @rows << TableRow.new(parent: self).parse(node_child) when 'tblPr' @properties = TableProperties.new(parent: self).parse(node_child) end end @number = number self end |
#to_s ⇒ String
Returns result of convert of object to string.
21 22 23 |
# File 'lib/ooxml_parser/common_parser/common_data/table.rb', line 21 def to_s "Rows: #{@rows.join(',')}" end |