Sha256: 361019a50dd98500412b408281408d2d04a2cdd992b7e0569a8091751c710b0a

Contents?: true

Size: 888 Bytes

Versions: 32

Compression:

Stored size: 888 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.parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
ooxml_parser-0.14.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.14.1-mingw32 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.14.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.14.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.13.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.12.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.12.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.12.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.11.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.10.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.9.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.9.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