Class: Hue::CLI::Commands::Light
- Inherits:
-
Hue::CLI::Command
- Object
- Hue::CLI::Command
- Hue::CLI::Commands::Light
- Defined in:
- lib/hue/cli/commands/light.rb
Instance Attribute Summary collapse
-
#bulb ⇒ Object
readonly
Returns the value of attribute bulb.
Instance Method Summary collapse
Methods inherited from Hue::CLI::Command
Constructor Details
This class inherits a constructor from Hue::CLI::Command
Instance Attribute Details
#bulb ⇒ Object (readonly)
Returns the value of attribute bulb.
6 7 8 |
# File 'lib/hue/cli/commands/light.rb', line 6 def bulb @bulb end |
Instance Method Details
#execute(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hue/cli/commands/light.rb', line 8 def execute(*args) arg = args.shift light_number = arg.to_i if light_number > 0 @bulb = Hue::Bulb.new(bridge, light_number) else raise Hue::CLI::Error.new("Not a valid light number: #{arg}") end # bulb exists (is valid?) if args.size > 0 if is_available?(args.first) super(*args) else if _alias = Processors::LightStateAlias.new(args.join(' ')) bulb.state = _alias.state end end else bulb.print_state end end |