Class: Rule
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#conditions ⇒ Object
readonly
Returns the value of attribute conditions.
-
#created ⇒ Object
readonly
Returns the value of attribute created.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_triggered ⇒ Object
readonly
Returns the value of attribute last_triggered.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#times_triggered ⇒ Object
readonly
Returns the value of attribute times_triggered.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(id = nil, data = {}) ⇒ Rule
constructor
A new instance of Rule.
Methods inherited from HObject
Constructor Details
#initialize(id = nil, data = {}) ⇒ Rule
Returns a new instance of Rule.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lights/rule.rb', line 7 def initialize( id = nil, data = {} ) @id = id @name = data["name"] @owner = data["owner"] @created = data["created"] @last_triggered = data["lasttriggered"] @times_triggered = data["timestriggered"] @status = data["status"] @conditions = data["conditions"] @actions = data["actions"] end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def actions @actions end |
#conditions ⇒ Object (readonly)
Returns the value of attribute conditions.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def conditions @conditions end |
#created ⇒ Object (readonly)
Returns the value of attribute created.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def created @created end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def id @id end |
#last_triggered ⇒ Object (readonly)
Returns the value of attribute last_triggered.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def last_triggered @last_triggered end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def name @name end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def owner @owner end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def status @status end |
#times_triggered ⇒ Object (readonly)
Returns the value of attribute times_triggered.
4 5 6 |
# File 'lib/lights/rule.rb', line 4 def times_triggered @times_triggered end |
Instance Method Details
#data ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lights/rule.rb', line 19 def data data = {} data["name"] = @name if @name data["owner"] = @owner if @owner data["created"] = @created if @created data["lasttriggered"] = @last_triggered if @last_triggered data["timestriggered"] = @times_triggered if @times_triggered data["status"] = @status if @status data["conditions"] = @conditions if @conditions data["actions"] = @actions if @actions data end |