Skip to content

Instantly share code, notes, and snippets.

@benlangfeld
Created November 11, 2011 16:57
Show Gist options
  • Save benlangfeld/1358528 to your computer and use it in GitHub Desktop.
Save benlangfeld/1358528 to your computer and use it in GitHub Desktop.
def play(*arguments)
result = true
arguments.each do |argument|
if argument.is_a? Hash
value = argument.delete(:value)
result = play_ssml_for(value, argument)
elsif argument.is_a? RubySpeech::SSML::Speak
result = play_ssml argument
else
result = play_ssml_for(argument)
end
end
result
end
def play!(*arguments)
result = true
arguments.each do |argument|
p argument.class
if argument.is_a? Hash
value = argument.delete(:value)
result = play_ssml_for(value, argument)
elsif argument.is_a? RubySpeech::SSML::Speak
result = play_ssml argument
else
result = play_ssml_for(argument)
end
if result == false
raise Adhearsion::PlaybackError, "One of the passed outputs is invalid"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment