Class: OoxmlParser::CommonTiming

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb

Overview

Class for data of CommonTiming

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(parent: nil) ⇒ CommonTiming

Returns a new instance of CommonTiming.



9
10
11
12
13
14
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 9

def initialize(parent: nil)
  @children = []
  @start_conditions = []
  @end_conditions = []
  super(parent: parent)
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def children
  @children
end

#durationObject

Returns the value of attribute duration.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def duration
  @duration
end

#end_conditionsObject

Returns the value of attribute end_conditions.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def end_conditions
  @end_conditions
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def id
  @id
end

#restartObject

Returns the value of attribute restart.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def restart
  @restart
end

#start_conditionsObject

Returns the value of attribute start_conditions.



7
8
9
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 7

def start_conditions
  @start_conditions
end

Instance Method Details

#parse(node) ⇒ CommonTiming

Parse CommonTiming object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/slide/timing/time_node_list/time_node/common_timing.rb', line 19

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'dur'
      @duration = value.value
    when 'restart'
      @restart = value.value
    when 'id'
      @id = value.value
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'stCondLst'
      @start_conditions = ConditionList.new(parent: self).parse(node_child)
    when 'endCondLst'
      @end_conditions = ConditionList.new(parent: self).parse(node_child)
    when 'childTnLst'
      @children = TimeNodeList.new(parent: self).parse(node_child).elements
    end
  end
  self
end