Sha256: 74e0c3e817836c9e9f7fc40311695b5f4a700c9a7d152d3ceb9831d1759556f0

Contents?: true

Size: 897 Bytes

Versions: 4

Compression:

Stored size: 897 Bytes

Contents

require_relative 'docx_shape_line_path/docx_shape_line_element'
module OoxmlParser
  # Docx Shape Line Path
  class DocxShapeLinePath < OOXMLDocumentObject
    attr_accessor :width, :height, :fill, :stroke, :elements

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

    # Parse DocxShapeLinePath object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [DocxShapeLinePath] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'w'
          @width = value.value.to_f
        when 'h'
          @height = value.value.to_f
        when 'stroke'
          @stroke = value.value.to_f
        end
      end
      node.xpath('*').each do |node_child|
        @elements << DocxShapeLineElement.new(parent: self).parse(node_child)
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb