Class: TapState

Inherits:
SensorState show all
Defined in:
lib/lights/sensor.rb

Instance Attribute Summary collapse

Attributes inherited from SensorState

#last_updated

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ TapState

Returns a new instance of TapState.



21
22
23
24
# File 'lib/lights/sensor.rb', line 21

def initialize(data)
  @button_event = data["button_event"]
  super
end

Instance Attribute Details

#button_eventObject (readonly)

Returns the value of attribute button_event.



20
21
22
# File 'lib/lights/sensor.rb', line 20

def button_event
  @button_event
end

Instance Method Details

#dataObject



26
27
28
29
30
# File 'lib/lights/sensor.rb', line 26

def data
  data = @data
  data["button_event"] = @button_event if @button_event
  data
end

#to_json(options = {}) ⇒ Object



32
33
34
# File 'lib/lights/sensor.rb', line 32

def to_json(options={})
  data.to_json
end