Class: OoxmlParser::SoundAction

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#end_soundObject

Returns the value of attribute end_sound.



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

def end_sound
  @end_sound
end

#start_soundObject

Returns the value of attribute start_sound.



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

def start_sound
  @start_sound
end

Class Method Details

.parse(sound_action_node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition/sound_action.rb', line 6

def self.parse(sound_action_node)
  return nil unless sound_action_node.name == 'sndAc'
  sound_action = SoundAction.new
  sound_action_node.xpath('*').each do |sound_action_node_child|
    case sound_action_node_child.name
    when 'stSnd'
      sound_action.start_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
    when 'endSnd'
      sound_action.end_sound = Sound.parse(sound_action_node_child.xpath('p:snd').first) unless sound_action_node_child.xpath('p:snd').first.nil?
    end
  end
  sound_action
end