Sha256: 829ff803c4d6f78ba936885efad5e6d51d2ce9f1624bed6c386d08bc7b9552a5

Contents?: true

Size: 948 Bytes

Versions: 9

Compression:

Stored size: 948 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for `bar` data
  class Bar < OOXMLDocumentObject
    # @return [ValuedChild] position object
    attr_reader :position_object
    attr_accessor :element

    def initialize(parent: nil)
      super
    end

    # Parse Bar object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [Bar] result of parsing
    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

    # @return [Symbol] position of bar
    def position
      @position_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/bar.rb
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/docx_formula/bar.rb