Class: Datastore
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
-
#lights ⇒ Object
readonly
Returns the value of attribute lights.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
-
#scenes ⇒ Object
readonly
Returns the value of attribute scenes.
-
#schedules ⇒ Object
readonly
Returns the value of attribute schedules.
-
#sensors ⇒ Object
readonly
Returns the value of attribute sensors.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(data = {}) ⇒ Datastore
constructor
A new instance of Datastore.
- #list ⇒ Object
Methods inherited from HObject
Constructor Details
#initialize(data = {}) ⇒ Datastore
Returns a new instance of Datastore.
13 14 15 16 17 18 19 20 21 |
# File 'lib/lights/datastore.rb', line 13 def initialize(data = {}) @lights = BulbList.new(data["lights"]) @groups = GroupList.new(data["groups"]) @config = HueConfig.new(data["config"]) @schedules = ScheduleList.new(data["schedules"]) @scenes = SceneList.new(data["scenes"]) @rules = RuleList.new(data["rules"]) @sensors = SensorList.new(data["sensors"]) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def config @config end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def groups @groups end |
#lights ⇒ Object (readonly)
Returns the value of attribute lights.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def lights @lights end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def rules @rules end |
#scenes ⇒ Object (readonly)
Returns the value of attribute scenes.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def scenes @scenes end |
#schedules ⇒ Object (readonly)
Returns the value of attribute schedules.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def schedules @schedules end |
#sensors ⇒ Object (readonly)
Returns the value of attribute sensors.
11 12 13 |
# File 'lib/lights/datastore.rb', line 11 def sensors @sensors end |
Instance Method Details
#data ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/lights/datastore.rb', line 33 def data data = {} data["lights"] = @lights.data if !@lights.data.empty? data["groups"] = @groups.data if !@groups.data.empty? data["config"] = @config.data if !@config.data.empty? data["schedules"] = @schedules.data if !@schedules.data.empty? data["scenes"] = @scenes.data if !@scenes.data.empty? data["rules"] = @rules.data if !@rules.data.empty? data["sensors"] = @sensors.data if !@sensors.data.empty? data end |
#list ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/lights/datastore.rb', line 23 def list @lights.list + \ @groups.list + \ [@config] + \ @schedules.list + \ @scenes.list + \ @rules.list + \ @sensors.list end |