Class: Group

Inherits:
Object
  • Object
show all
Defined in:
lib/lights/group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil, data = {}) ⇒ Group

Returns a new instance of 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

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/lights/group.rb', line 3

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/lights/group.rb', line 3

def id
  @id
end

#lightsObject

Returns the value of attribute lights.



3
4
5
# File 'lib/lights/group.rb', line 3

def lights
  @lights
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/lights/group.rb', line 3

def name
  @name
end

Instance Method Details

#actionObject



13
14
15
# File 'lib/lights/group.rb', line 13

def action
  @action.data
end

#to_json(options = {}) ⇒ Object



25
26
27
# File 'lib/lights/group.rb', line 25

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