Sha256: f671c4e9b9f08a481339bd9734519d5e5ea482dd1a8b5ebc85b88c0733ef9c6c

Contents?: true

Size: 906 Bytes

Versions: 9

Compression:

Stored size: 906 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
      super(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.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ooxml_parser-0.38.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.37.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.37.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.36.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.36.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.35.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.34.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.34.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.34.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