Sha256: 94b06e9e00341d767aa785b26ae44a517ab428299845f8e0d1830884d5271b66

Contents?: true

Size: 891 Bytes

Versions: 9

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for `acc` data
  class Accent < OOXMLDocumentObject
    # @return [ValuedChild] symbol object
    attr_reader :symbol_object
    attr_accessor :element

    # Parse Accent object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [Accent] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'accPr'
          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)
            end
          end
        end
      end
      @element = DocxFormula.new(parent: self).parse(node)
      self
    end

    # @return [String] symbol value
    def symbol
      @symbol_object.value
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ooxml_parser-0.38.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/accent.rb