Class: Bulb
- Inherits:
-
Object
- Object
- Bulb
- Defined in:
- lib/lights/bulb.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#swversion ⇒ Object
readonly
Returns the value of attribute swversion.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(id, data = {}) ⇒ Bulb
constructor
A new instance of Bulb.
Constructor Details
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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def name @name end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def state @state end |
#swversion ⇒ Object (readonly)
Returns the value of attribute swversion.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def swversion @swversion end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/lights/bulb.rb', line 5 def type @type end |
Instance Method Details
#data ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/lights/bulb.rb', line 16 def data data = {} data["name"] = @name if @name data["type"] = @type if @type data["swversion"] = @swversion if @swversion data["state"] = @state.data if !@state.data.empty? data end |