A Schedule
can have many reoccurring and exception rules. You could get them by doing schedule.recurrence_rules
or schedule.exception_rules
. In addition there can be recurrence times and exception times as well. (For detailed information on what these rules are, head to: https://github.com/seejohnrun/ice_cube#quick-introductions)
Hence, it is a best practice to just store a serialized Schedule
in the database and not a particular rule.
If you wish, methods like to_hash
and to_yaml
are available on a rule as well:
irb(main)> schedule.recurrence_rules.first.to_yaml
=> "---\n:validations: {}\n:rule_type: IceCube::DailyRule\n:interval: 1\n"
irb(main)> schedule.recurrence_rules.first.to_hash
=> {:validations=>{}, :rule_type=>"IceCube::DailyRule", :interval=>1}