Class: OoxmlParser::Transition

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb

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, #initialize, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#advance_on_clickObject

Returns the value of attribute advance_on_click.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def advance_on_click
  @advance_on_click
end

#delayObject

Returns the value of attribute delay.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def delay
  @delay
end

#durationObject

Returns the value of attribute duration.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def duration
  @duration
end

#propertiesObject

Returns the value of attribute properties.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def properties
  @properties
end

#sound_actionObject

Returns the value of attribute sound_action.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def sound_action
  @sound_action
end

#speedObject

Returns the value of attribute speed.



5
6
7
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 5

def speed
  @speed
end

Instance Method Details

#parse(node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb', line 7

def parse(node)
  node.xpath('*').each do |node_child|
    @properties = TransitionProperties.new(parent: self).parse(node_child)
    case node_child.name
    when 'sndAc'
      @sound_action = SoundAction.new(parent: self).parse(node_child)
    end
  end
  node.attributes.each do |key, value|
    case key
    when 'spd'
      @speed = value.value.to_sym
    when 'advClick'
      @advance_on_click = attribute_enabled?(value)
    when 'advTm'
      @delay = value.value.to_f / 1_000.0
    when 'dur'
      @duration = value.value.to_f / 1_000.0
    end
  end
  self
end