class OoxmlParser::Delimiter

Class for ‘d` data

Attributes

begin_character[RW]
end_character[RW]
value[RW]

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/delimeter.rb, line 8
def initialize(parent: nil)
  @begin_character = '('
  @end_character = ')'
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse Delimiter object @param node [Nokogiri::XML:Element] node to parse @return [Delimiter] result of parsing

# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/delimeter.rb, line 17
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'dPr'
      node_child.xpath('*').each do |node_child_child|
        case node_child_child.name
        when 'begChr'
          @begin_character = ValuedChild.new(:string, parent: self).parse(node_child_child)
        when 'endChr'
          @end_character = ValuedChild.new(:string, parent: self).parse(node_child_child)
        end
      end
    end
  end
  @value = DocxFormula.new(parent: self).parse(node)
  self
end