class AlexaShell
Public Class Methods
new(modelstxt=[], debug: false, userid: nil, deviceid: nil)
click to toggle source
Calls superclass method
# File lib/alexa_skillsimulator.rb, line 12 def initialize(modelstxt=[], debug: false, userid: nil, deviceid: nil) @alexa = AlexaSkillSimulator.new(modelstxt, debug: debug, userid: userid, deviceid: deviceid) super(debug: debug) end
Public Instance Methods
display_output(s='')
click to toggle source
# File lib/alexa_skillsimulator.rb, line 24 def display_output(s='') print s + "\n\n => Alexa is ready\n\n> " end
start()
click to toggle source
Calls superclass method
# File lib/alexa_skillsimulator.rb, line 20 def start() super() end
Protected Instance Methods
clear_cli()
click to toggle source
# File lib/alexa_skillsimulator.rb, line 32 def clear_cli() end
on_enter(raw_command)
click to toggle source
# File lib/alexa_skillsimulator.rb, line 44 def on_enter(raw_command) command = raw_command.downcase puts 'on_enter: ' + command.inspect if @debug case command when /^open|tell|ask$/ response = @alexa.ask command "Alexa says: " + response when /^what can i say/ return "you can say the following: \n\n" \ + "open #{@alexa.invocation}\n" + @alexa.utterances.keys.join("\n") when /^bye|quit|stop|exit$/ return (@running=false; '' ) else return @alexa.ask command end end
on_keypress(key)
click to toggle source
Calls superclass method
# File lib/alexa_skillsimulator.rb, line 69 def on_keypress(key) @running = false if key == :ctrl_c super(key) end