Class: OoxmlParser::Columns
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Columns
- Defined in:
- lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb
Overview
Class for data of Columns
Instance Attribute Summary collapse
-
#column_array ⇒ Array<Column>
List of colujmns.
-
#count ⇒ Integer
Count of columns.
-
#equal_width ⇒ True, False
(also: #equal_width?)
Is columns are equal width.
-
#separator ⇒ Boolean
readonly
Draw Line Between Columns.
-
#space ⇒ OoxmlSize
Space between columns.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#[](key) ⇒ Array, Column
Accessor.
-
#initialize(columns_count = 0) ⇒ Columns
constructor
A new instance of Columns.
-
#parse(node) ⇒ Columns
Parse 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(columns_count = 0) ⇒ Columns
Returns a new instance of Columns.
19 20 21 22 23 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 19 def initialize(columns_count = 0) @count = columns_count @column_array = [] super(parent: nil) end |
Instance Attribute Details
#column_array ⇒ Array<Column>
Returns list of colujmns.
13 14 15 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 13 def column_array @column_array end |
#count ⇒ Integer
Returns count of columns.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 8 def count @count end |
#equal_width ⇒ True, False Also known as: equal_width?
Returns is columns are equal width.
10 11 12 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 10 def equal_width @equal_width end |
#separator ⇒ Boolean (readonly)
Returns Draw Line Between Columns.
15 16 17 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 15 def separator @separator end |
#space ⇒ OoxmlSize
Returns space between columns.
17 18 19 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 17 def space @space end |
Instance Method Details
#[](key) ⇒ Array, Column
Returns accessor.
26 27 28 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 26 def [](key) @column_array[key] end |
#parse(node) ⇒ Columns
Parse Columns data
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ooxml_parser/docx_parser/document_structure/page_properties/columns.rb', line 33 def parse(node) node.attributes.each do |key, value| case key when 'num' @count = value.value.to_i when 'sep' @separator = boolean_attribute_value(value) when 'equalWidth' @equal_width = boolean_attribute_value(value) when 'space' @space = OoxmlSize.new(value.value.to_f) end end node.xpath('*').each do |column_node| case column_node.name when 'col' @column_array << Column.new(parent: self).parse(column_node) end end self end |