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

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

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

Returns a new instance of DocxShapeLinePath.



7
8
9
10
# 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 initialize(elements = [], parent: nil)
  @elements = elements
  @parent = parent
end

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



5
6
7
# 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 5

def elements
  @elements
end

#fillObject

Returns the value of attribute fill.



5
6
7
# 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 5

def fill
  @fill
end

#heightObject

Returns the value of attribute height.



5
6
7
# 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 5

def height
  @height
end

#strokeObject

Returns the value of attribute stroke.



5
6
7
# 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 5

def stroke
  @stroke
end

#widthObject

Returns the value of attribute width.



5
6
7
# 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 5

def width
  @width
end

Instance Method Details

#parse(node) ⇒ DocxShapeLinePath

Parse DocxShapeLinePath object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# 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 15

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