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, data = {}) ⇒ Group

Returns a new instance of Group.



4
5
6
7
8
9
10
# File 'lib/lights/group.rb', line 4

def initialize( id, 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 (readonly)

Returns the value of attribute lights.



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

def lights
  @lights
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#actionObject



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

def action
  @action.data
end