Class: Group
- Inherits:
-
Object
- Object
- Group
- Defined in:
- lib/lights/group.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lights ⇒ Object
Returns the value of attribute lights.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #action ⇒ Object
-
#initialize(id = nil, data = {}) ⇒ Group
constructor
A new instance of Group.
- #to_json ⇒ Object
Constructor Details
#initialize(id = nil, data = {}) ⇒ Group
5 6 7 8 9 10 11 |
# File 'lib/lights/group.rb', line 5 def initialize( id = nil, data = {} ) @id = id @data = data @action = BulbState.new(data["action"]) @name = data["name"] @lights = data["lights"] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/lights/group.rb', line 3 def data @data end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/lights/group.rb', line 3 def id @id end |
#lights ⇒ Object
Returns the value of attribute lights.
3 4 5 |
# File 'lib/lights/group.rb', line 3 def lights @lights end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/lights/group.rb', line 3 def name @name end |
Instance Method Details
#action ⇒ Object
13 14 15 |
# File 'lib/lights/group.rb', line 13 def action @action.data end |
#to_json ⇒ Object
26 27 28 |
# File 'lib/lights/group.rb', line 26 def to_json data.to_json end |