Class: OoxmlParser::Transition

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

Overview

Class for data of Transition

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

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.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def advance_on_click
  @advance_on_click
end

#delayObject

Returns the value of attribute delay.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def delay
  @delay
end

#durationObject

Returns the value of attribute duration.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def duration
  @duration
end

#propertiesObject

Returns the value of attribute properties.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def properties
  @properties
end

#sound_actionObject

Returns the value of attribute sound_action.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def sound_action
  @sound_action
end

#speedObject

Returns the value of attribute speed.



8
9
10
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 8

def speed
  @speed
end

Instance Method Details

#parse(node) ⇒ Transition

Parse Transition object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ooxml_parser/pptx_parser/presentation/slide/transition/transition.rb', line 13

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