class Light
Public Class Methods
new(key, hashvalue, grouparray)
click to toggle source
Calls superclass method
HueResource::new
# File lib/ha/light.rb, line 4 def initialize(key, hashvalue, grouparray) super(key, hashvalue) @grouparray = grouparray @onstate = hashvalue.dig("state", "on") @brightstate = hashvalue.dig("state", "bri") @combinedsate = "#{@onstate} (#{@brightstate})" @number = key @group = Group.owning(key, grouparray) gen_reskey("l") build_name @state.merge! ({"on" => @combinedsate}) end
Public Instance Methods
array(selectors)
click to toggle source
# File lib/ha/light.rb, line 21 def array(selectors) selectors.map { |key| @state[key] } end
build_name()
click to toggle source
# File lib/ha/light.rb, line 17 def build_name @state["detail"] += " in " + Group.owning(@number, @grouparray).first.name end