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
- #scheduled_time_met?(time) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Schedule
Returns a new instance of Schedule.
5 6 7 8 |
# File 'lib/fist_of_fury/schedule.rb', line 5 def initialize start_time = FistOfFury.config.utc ? Time.now.utc : Time.now 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
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fist_of_fury/schedule.rb', line 10 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
#scheduled_time_met?(time) ⇒ Boolean
22 23 24 25 26 27 |
# File 'lib/fist_of_fury/schedule.rb', line 22 def scheduled_time_met?(time) self.last_occurrence = next_occurrence(time) unless last_occurrence return false if last_occurrence_is_next_occurrence?(time) self.last_occurrence = next_occurrence(time) true end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/fist_of_fury/schedule.rb', line 29 def to_s ice_cube_schedule.to_s end |