Class: FistOfFury::Schedule
- Inherits:
-
Object
- Object
- FistOfFury::Schedule
- Defined in:
- lib/fist_of_fury/schedule.rb
Instance Attribute Summary collapse
-
#ice_cube_schedule ⇒ Object
Returns the value of attribute ice_cube_schedule.
-
#last_occurrence ⇒ Object
Returns the value of attribute last_occurrence.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ Schedule
constructor
A new instance of Schedule.
- #method_missing(meth, *args, &block) ⇒ Object
- #schedule_next(time) ⇒ Object
- #start_time ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Schedule
Returns a new instance of Schedule.
5 6 7 |
# File 'lib/fist_of_fury/schedule.rb', line 5 def initialize self.ice_cube_schedule = IceCube::Schedule.new(start_time) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/fist_of_fury/schedule.rb', line 9 def method_missing(meth, *args, &block) if IceCube::Rule.respond_to?(meth) rule = IceCube::Rule.send(meth, *args, &block) ice_cube_schedule.add_recurrence_rule(rule) rule elsif ice_cube_schedule.respond_to?(meth) ice_cube_schedule.send(meth, *args, &block) else super end end |
Instance Attribute Details
#ice_cube_schedule ⇒ Object
Returns the value of attribute ice_cube_schedule.
3 4 5 |
# File 'lib/fist_of_fury/schedule.rb', line 3 def ice_cube_schedule @ice_cube_schedule end |
#last_occurrence ⇒ Object
Returns the value of attribute last_occurrence.
3 4 5 |
# File 'lib/fist_of_fury/schedule.rb', line 3 def last_occurrence @last_occurrence end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/fist_of_fury/schedule.rb', line 3 def @options end |
Instance Method Details
#schedule_next(time) ⇒ Object
21 22 23 24 25 |
# File 'lib/fist_of_fury/schedule.rb', line 21 def schedule_next(time) return unless schedule_next?(time) self.last_occurrence = next_occurrence(time) yield end |
#start_time ⇒ Object
31 32 33 |
# File 'lib/fist_of_fury/schedule.rb', line 31 def start_time @start_time ||= FistOfFury.config.utc ? Time.utc(2010, 1, 1) : Time.local(2010, 1, 1) end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/fist_of_fury/schedule.rb', line 27 def to_s ice_cube_schedule.to_s end |