Class: Scene

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#activeObject (readonly)

Returns the value of attribute active.



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

def active
  @active
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#lightsObject (readonly)

Returns the value of attribute lights.



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

def lights
  @lights
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Instance Method Details

#dataObject



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(options={})
  data.to_json
end