Class: OoxmlParser::DocxShapeLinePath

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb

Overview

Docx Shape Line Path

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(elements = [], parent: nil) ⇒ DocxShapeLinePath

Returns a new instance of DocxShapeLinePath.



9
10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 9

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

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 7

def elements
  @elements
end

#fillObject

Returns the value of attribute fill.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 7

def fill
  @fill
end

#heightObject

Returns the value of attribute height.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 7

def height
  @height
end

#strokeObject

Returns the value of attribute stroke.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 7

def stroke
  @stroke
end

#widthObject

Returns the value of attribute width.



7
8
9
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 7

def width
  @width
end

Instance Method Details

#parse(node) ⇒ DocxShapeLinePath

Parse DocxShapeLinePath object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_properties/custom_geometry/docx_custom_geometry/docx_shape_line_path.rb', line 17

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