Class: OoxmlParser::GroupChar

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

Overview

Class for ‘groupChr` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#elementObject

Returns the value of attribute element.



12
13
14
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/group_char.rb', line 12

def element
  @element
end

#position_objectValuedChild (readonly)

Returns position object.

Returns:



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

def position_object
  @position_object
end

#symbol_objectValuedChild (readonly)

Returns symbol object.

Returns:



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

def symbol_object
  @symbol_object
end

#vertical_align_objectValuedChild (readonly)

Returns vertical align object.

Returns:



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

def vertical_align_object
  @vertical_align_object
end

Instance Method Details

#parse(node) ⇒ GroupChar

Parse GroupChar object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



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

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'groupChrPr'
      node_child.xpath('*').each do |node_child_child|
        case node_child_child.name
        when 'chr'
          @symbol_object = ValuedChild.new(:string, parent: self).parse(node_child_child)
        when 'pos'
          @position_object = ValuedChild.new(:string, parent: self).parse(node_child_child)
        when 'vertJc'
          @vertical_align_object = ValuedChild.new(:string, parent: self).parse(node_child_child)
        end
      end
    end
  end
  @element = DocxFormula.new(parent: self).parse(node)
  self
end

#positionString

Returns position value.

Returns:

  • (String)

    position value



43
44
45
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/group_char.rb', line 43

def position
  @position_object.value
end

#symbolString

Returns symbol value.

Returns:

  • (String)

    symbol value



38
39
40
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/group_char.rb', line 38

def symbol
  @symbol_object.value
end

#vertical_alignString

Returns vertical align value.

Returns:

  • (String)

    vertical align value



48
49
50
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/group_char.rb', line 48

def vertical_align
  @vertical_align_object.value
end