Class: Scene
- Inherits:
-
Object
- Object
- Scene
- Defined in:
- lib/lights/scene.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Returns the value of attribute active.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#lights ⇒ Object
readonly
Returns the value of attribute lights.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(id, data = {}) ⇒ Scene
constructor
A new instance of Scene.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(id, data = {}) ⇒ Scene
Returns a new instance of Scene.
5 6 7 8 9 10 |
# File 'lib/lights/scene.rb', line 5 def initialize(id,data = {}) @id = id @name = data["name"] @active = data["active"] @lights = data["lights"] end |
Instance Attribute Details
#active ⇒ Object (readonly)
Returns the value of attribute active.
3 4 5 |
# File 'lib/lights/scene.rb', line 3 def active @active end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/lights/scene.rb', line 3 def id @id end |
#lights ⇒ Object (readonly)
Returns the value of attribute lights.
3 4 5 |
# File 'lib/lights/scene.rb', line 3 def lights @lights end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lights/scene.rb', line 3 def name @name end |
Instance Method Details
#data ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/lights/scene.rb', line 12 def data data = {} data["name"] = @name if @name data["active"] = @active if @active data["lights"] = @lights if @lights data end |
#to_json(options = {}) ⇒ Object
20 21 22 |
# File 'lib/lights/scene.rb', line 20 def to_json(={}) data.to_json end |