Class: Group
- Inherits:
-
HueResource
- Object
- HueResource
- Group
- Defined in:
- lib/ha/group.rb
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#lights ⇒ Object
readonly
Returns the value of attribute lights.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#on ⇒ Object
readonly
Returns the value of attribute on.
Class Method Summary collapse
Instance Method Summary collapse
- #array(selectors) ⇒ Object
-
#initialize(key, hashvalue) ⇒ Group
constructor
A new instance of Group.
Methods inherited from HueResource
Constructor Details
#initialize(key, hashvalue) ⇒ Group
Returns a new instance of Group.
4 5 6 7 8 9 10 |
# File 'lib/ha/group.rb', line 4 def initialize(key, hashvalue) super @lights = hashvalue["lights"] @lights_s = hashvalue["lights"].join(",") gen_reskey("g") @state.merge! ({"on" =>@lights_s, "name" => @name, "detail" => @detail}) end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
3 4 5 |
# File 'lib/ha/group.rb', line 3 def detail @detail end |
#lights ⇒ Object (readonly)
Returns the value of attribute lights.
3 4 5 |
# File 'lib/ha/group.rb', line 3 def lights @lights end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/ha/group.rb', line 3 def name @name end |
#on ⇒ Object (readonly)
Returns the value of attribute on.
3 4 5 |
# File 'lib/ha/group.rb', line 3 def on @on end |
Class Method Details
.owning(number, grouparray) ⇒ Object
16 17 18 |
# File 'lib/ha/group.rb', line 16 def self.owning(number, grouparray) grouparray.select { |group| group.lights.include? number} end |
Instance Method Details
#array(selectors) ⇒ Object
12 13 14 |
# File 'lib/ha/group.rb', line 12 def array(selectors) selectors.map { |key| @state[key] } end |