Sha256: 5b19d7b94a04cb59e6d74154b375eadddb8e5bd4abd3b2bb5e78eaa97c934c3f

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Docx Shape Line Element
  class DocxShapeLineElement < OOXMLDocumentObject
    attr_accessor :type, :points

    def initialize(points = [], parent: nil)
      @points = points
      @parent = parent
    end

    # Parse DocxShapeLineElement
    # @param [Nokogiri::XML:Node] node with DocxShapeLineElement
    # @return [DocxShapeLineElement] result of parsing
    def parse(node)
      case node.name
      when 'moveTo'
        @type = :move
      when 'lnTo'
        @type = :line
      when 'arcTo'
        @type = :arc
      when 'cubicBezTo'
        @type = :cubic_bezier
      when 'close'
        @type = :close
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'pt'
          @points << OOXMLCoordinates.parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path/docx_shape_line_element.rb