Class: OoxmlParser::PresentationShape

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(non_visual_properties = nil, shape_properties = nil, text_body = nil) ⇒ PresentationShape

Returns a new instance of PresentationShape.



7
8
9
10
11
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb', line 7

def initialize(non_visual_properties = nil, shape_properties = nil, text_body = nil)
  @non_visual_properties = non_visual_properties
  @shape_properties = shape_properties
  @text_body = text_body
end

Instance Attribute Details

#non_visual_propertiesObject

Returns the value of attribute non_visual_properties.



5
6
7
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb', line 5

def non_visual_properties
  @non_visual_properties
end

#shape_propertiesObject

Returns the value of attribute shape_properties.



5
6
7
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb', line 5

def shape_properties
  @shape_properties
end

#text_bodyObject

Returns the value of attribute text_body.



5
6
7
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb', line 5

def text_body
  @text_body
end

Class Method Details

.parse(shape_node) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/shape/shape.rb', line 13

def self.parse(shape_node)
  shape = PresentationShape.new
  shape_node.xpath('*').each do |shape_node_child|
    case shape_node_child.name
    when 'nvSpPr'
      shape.non_visual_properties = NonVisualShapeProperties.parse(shape_node_child)
    when 'spPr'
      shape.shape_properties = DocxShapeProperties.parse(shape_node_child)
    when 'txBody'
      shape.text_body = TextBody.parse(shape_node_child)
    end
  end
  shape
end