Class: Bulb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#model_id ⇒ Object
readonly
Returns the value of attribute model_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#point_symbol ⇒ Object
readonly
Returns the value of attribute point_symbol.
-
#state ⇒ Object
Returns the value of attribute state.
-
#sw_version ⇒ Object
readonly
Returns the value of attribute sw_version.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unique_id ⇒ Object
readonly
Returns the value of attribute unique_id.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(id, data = {}) ⇒ Bulb
constructor
A new instance of Bulb.
Methods inherited from HObject
Constructor Details
#initialize(id, data = {}) ⇒ Bulb
Returns a new instance of Bulb.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/lights/bulb.rb', line 8 def initialize(id,data = {}) @id = id @name = data["name"] @type = data["type"] @sw_version = data["swversion"] @point_symbol = data["pointsymbol"] @model_id = data["modelid"] @unique_id = data["uniqueid"] @state = BulbState.new data["state"] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def id @id end |
#model_id ⇒ Object (readonly)
Returns the value of attribute model_id.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def model_id @model_id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def name @name end |
#point_symbol ⇒ Object (readonly)
Returns the value of attribute point_symbol.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def point_symbol @point_symbol end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def state @state end |
#sw_version ⇒ Object (readonly)
Returns the value of attribute sw_version.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def sw_version @sw_version end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def type @type end |
#unique_id ⇒ Object (readonly)
Returns the value of attribute unique_id.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def unique_id @unique_id end |
Instance Method Details
#data ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lights/bulb.rb', line 19 def data data = {} data["name"] = @name if @name data["type"] = @type if @type data["swversion"] = @sw_version if @sw_version data["state"] = @state.data unless @state.data.empty? data["pointsymbol"] = @point_symbol if @point_symbol data["modelid"] = @model_id if @model_id data["uniqueid"] = @unique_id if @unique_id data end |