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