Class: Scene

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HObject

#to_json

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

Returns the value of attribute active.



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

def active
  @active
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#lightsObject

Returns the value of attribute lights.



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

def lights
  @lights
end

#nameObject

Returns the value of attribute name.



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

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 unless @active.nil?
  data["lights"] = @lights if @lights
  data
end