Class: Ralyxa::OutputSpeech

Inherits:
Object
  • Object
show all
Defined in:
lib/ralyxa/output_speech.rb

Constant Summary collapse

DEFAULT_RESPONSE_TEXT =
"Hello World"
DEFAULT_RESPONSE_SSML =
"<speak>Hello World</speak>"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(speech, ssml) ⇒ OutputSpeech

Returns a new instance of OutputSpeech.



6
7
8
9
# File 'lib/ralyxa/output_speech.rb', line 6

def initialize(speech, ssml)
  @speech = speech
  @ssml   = ssml
end

Class Method Details

.as_hash(speech: nil, ssml: false) ⇒ Object



17
18
19
# File 'lib/ralyxa/output_speech.rb', line 17

def self.as_hash(speech: nil, ssml: false)
  new(speech, ssml).to_h
end

Instance Method Details

#to_hObject



11
12
13
14
15
# File 'lib/ralyxa/output_speech.rb', line 11

def to_h
  Hash.new.tap do |output_speech|
    @ssml ? set_ssml(output_speech) : set_plaintext(output_speech)
  end
end