Class: OoxmlParser::Behavior

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(common_time_node = nil, attribute_name_list = [], target = nil) ⇒ Behavior

Returns a new instance of Behavior.



6
7
8
9
10
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb', line 6

def initialize(common_time_node = nil, attribute_name_list = [], target = nil)
  @common_time_node = common_time_node
  @attribute_name_list = attribute_name_list
  @target = target
end

Instance Attribute Details

#attribute_name_listObject

Returns the value of attribute attribute_name_list.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb', line 4

def attribute_name_list
  @attribute_name_list
end

#common_time_nodeObject

Returns the value of attribute common_time_node.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb', line 4

def common_time_node
  @common_time_node
end

#targetObject

Returns the value of attribute target.



4
5
6
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb', line 4

def target
  @target
end

Class Method Details

.parse(behavior_node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/slide/timing/set_time_node/behavior/behavior.rb', line 12

def self.parse(behavior_node)
  behavior = Behavior.new
  behavior_node.xpath('*').each do |behavior_node_child|
    case behavior_node_child.name
    when 'cTn'
      behavior.common_time_node = CommonTiming.parse(behavior_node_child)
    when 'tgtEl'
      behavior.target = TargetElement.parse(behavior_node_child)
    when 'attrNameLst'
      behavior_node_child.xpath('p:attrName').each do |attribute_name_node|
        behavior.attribute_name_list << attribute_name_node.text
      end
    end
  end
  behavior
end