Class: OoxmlParser::TargetElement

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb

Overview

Class for data for Target Element

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(type = '', id = '', parent: nil) ⇒ TargetElement

Returns a new instance of TargetElement.



8
9
10
11
12
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 8

def initialize(type = '', id = '', parent: nil)
  @type = type
  @id = id
  super(parent: parent)
end

Instance Attribute Details

#built_inObject

Returns the value of attribute built_in.



6
7
8
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 6

def built_in
  @built_in
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 6

def name
  @name
end

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 6

def type
  @type
end

Instance Method Details

#parse(node) ⇒ TargetElement

Parse TargetElement object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



17
18
19
20
21
22
23
24
25
26
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/set_time_node/behavior/target_element.rb', line 17

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'spTgt'
      @type = :shape
      @id = node_child.attribute('spid').value
    end
  end
  self
end