Class: SensorState
Instance Attribute Summary collapse
-
#last_updated ⇒ Object
readonly
Returns the value of attribute last_updated.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(data) ⇒ SensorState
constructor
A new instance of SensorState.
Methods inherited from HObject
Constructor Details
#initialize(data) ⇒ SensorState
Returns a new instance of SensorState.
3 4 5 6 7 |
# File 'lib/lights/sensor.rb', line 3 def initialize(data) @last_updated = data["lastupdated"] @daylight = data["daylight"] @button_event = data["buttonevent"] end |
Instance Attribute Details
#last_updated ⇒ Object (readonly)
Returns the value of attribute last_updated.
2 3 4 |
# File 'lib/lights/sensor.rb', line 2 def last_updated @last_updated end |
Instance Method Details
#data ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/lights/sensor.rb', line 9 def data data = {} data["lastupdated"] = @last_updated if @last_updated data["daylight"] = @daylight unless @daylight.nil? data["buttonevent"] = @button_event if @button_event data end |