Class: Rule
- Inherits:
-
HueResource
- Object
- HueResource
- Rule
- Defined in:
- lib/ha/rule.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) ⇒ Rule
constructor
A new instance of Rule.
Methods inherited from HueResource
Constructor Details
#initialize(key, hashvalue) ⇒ Rule
Returns a new instance of Rule.
5 6 7 8 9 10 |
# File 'lib/ha/rule.rb', line 5 def initialize(key, hashvalue) super(key, hashvalue) @detail = "#{hashvalue["conditions"].length} conds => #{hashvalue["actions"].length} acts" @state.merge! ({"on" => @hash_value["status"], "name" => @name, "detail" => @detail}) gen_reskey("r") end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
4 5 6 |
# File 'lib/ha/rule.rb', line 4 def detail @detail end |
#lights ⇒ Object (readonly)
Returns the value of attribute lights.
4 5 6 |
# File 'lib/ha/rule.rb', line 4 def lights @lights end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ha/rule.rb', line 4 def name @name end |
#on ⇒ Object (readonly)
Returns the value of attribute on.
4 5 6 |
# File 'lib/ha/rule.rb', line 4 def on @on end |
Class Method Details
.owning(number, grouparray) ⇒ Object
16 17 18 |
# File 'lib/ha/rule.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/rule.rb', line 12 def array(selectors) selectors.map { |key| @state[key] } end |