Class: OoxmlParser::Bar

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb

Overview

Class for ‘bar` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Bar

Returns a new instance of Bar.



10
11
12
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb', line 10

def initialize(parent: nil)
  super
end

Instance Attribute Details

#elementObject

Returns the value of attribute element.



8
9
10
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb', line 8

def element
  @element
end

#position_objectValuedChild (readonly)

Returns position object.

Returns:



7
8
9
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb', line 7

def position_object
  @position_object
end

Instance Method Details

#parse(node) ⇒ Bar

Parse Bar object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:

  • (Bar)

    result of parsing



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb', line 17

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'barPr'
      node_child.xpath('*').each do |node_child_child|
        case node_child_child.name
        when 'pos'
          @position_object = ValuedChild.new(:symbol, parent: self).parse(node_child_child)
        end
      end
    end
  end
  @element = DocxFormula.new(parent: self).parse(node)
  self
end

#positionSymbol

Returns position of bar.

Returns:

  • (Symbol)

    position of bar



34
35
36
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb', line 34

def position
  @position_object.value
end