Class: Hue::VoiceParser
- Inherits:
-
Object
- Object
- Hue::VoiceParser
- Includes:
- Helpers
- Defined in:
- lib/alexa_hue/hue/voice_parser.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ VoiceParser
constructor
A new instance of VoiceParser.
- #voice(string) ⇒ Object
Methods included from Helpers
#fix_schedule_syntax, #numbers_to_times, #parse_time, #set_time
Constructor Details
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
8 9 10 |
# File 'lib/alexa_hue/hue/voice_parser.rb', line 8 def client @client end |
Instance Method Details
#voice(string) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/alexa_hue/hue/voice_parser.rb', line 14 def voice(string) @client.reset @client.command << string parse_voice(string) if @client.command.include?("schedule") state = string.match(/off|on/)[0].to_sym rescue nil @client.schedule(*[string, state]) else string.include?(' off') ? @client.off : @client.on end end |