Class: RubyHue::LightsCollection
- Inherits:
-
Object
- Object
- RubyHue::LightsCollection
- Includes:
- Enumerable
- Defined in:
- lib/ruby_hue/lights_collection.rb
Instance Attribute Summary collapse
-
#bridge ⇒ Object
readonly
Returns the value of attribute bridge.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(bridge) ⇒ LightsCollection
constructor
A new instance of LightsCollection.
- #lights ⇒ Object
- #state ⇒ Object
Constructor Details
#initialize(bridge) ⇒ LightsCollection
Returns a new instance of LightsCollection.
7 8 9 |
# File 'lib/ruby_hue/lights_collection.rb', line 7 def initialize(bridge) @bridge = bridge end |
Instance Attribute Details
#bridge ⇒ Object (readonly)
Returns the value of attribute bridge.
5 6 7 |
# File 'lib/ruby_hue/lights_collection.rb', line 5 def bridge @bridge end |
Instance Method Details
#each(&block) ⇒ Object
21 22 23 24 25 |
# File 'lib/ruby_hue/lights_collection.rb', line 21 def each(&block) lights.each do |light| yield light end end |
#lights ⇒ Object
11 12 13 14 15 |
# File 'lib/ruby_hue/lights_collection.rb', line 11 def lights Client.get_and_parse(bridge.resource_url_for("lights")).map do |id, light| RubyHue::Light.new(id, self) end end |
#state ⇒ Object
17 18 19 |
# File 'lib/ruby_hue/lights_collection.rb', line 17 def state @state ||= LightsCollectionState.new(self) end |