Class: Hue::Scene

Inherits:
Object
  • Object
show all
Includes:
Enumerable, TranslateKeys
Defined in:
lib/hue/scene.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TranslateKeys

#translate_keys, #unpack_hash

Constructor Details

#initialize(client, bridge, id, data) ⇒ Scene

Returns a new instance of Scene


18
19
20
21
22
23
24
# File 'lib/hue/scene.rb', line 18

def initialize(client, bridge, id, data)
  @client = client
  @bridge = bridge
  @id = id

  unpack(data)
end

Instance Attribute Details

#activeObject (readonly)

Whether or not the scene is active on a group.


16
17
18
# File 'lib/hue/scene.rb', line 16

def active
  @active
end

#bridgeObject (readonly)

Bridge the scene is associated with


10
11
12
# File 'lib/hue/scene.rb', line 10

def bridge
  @bridge
end

#idObject (readonly)

Unique identification number.


7
8
9
# File 'lib/hue/scene.rb', line 7

def id
  @id
end

#nameObject

A unique, editable name given to the scene.


13
14
15
# File 'lib/hue/scene.rb', line 13

def name
  @name
end

Instance Method Details

#lightsObject


26
27
28
29
30
31
32
# File 'lib/hue/scene.rb', line 26

def lights
  @lights ||= begin
    @light_ids.map do |light_id|
      @client.light(light_id)
    end
  end
end