Class: BulbList
- Inherits:
-
Object
- Object
- BulbList
- Defined in:
- lib/lights/bulblist.rb
Instance Attribute Summary collapse
-
#bulbs ⇒ Object
readonly
Returns the value of attribute bulbs.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(data = {}) ⇒ BulbList
constructor
A new instance of BulbList.
- #to_json(options = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#bulbs ⇒ Object (readonly)
Returns the value of attribute bulbs.
5 6 7 |
# File 'lib/lights/bulblist.rb', line 5 def bulbs @bulbs end |
Instance Method Details
#data ⇒ Object
12 13 14 15 16 |
# File 'lib/lights/bulblist.rb', line 12 def data data = @data @bulbs.each {|b| data[b.id] = b.data} if @bulbs data end |
#to_json(options = {}) ⇒ Object
18 19 20 |
# File 'lib/lights/bulblist.rb', line 18 def to_json(={}) data.to_json end |