Class: BiblioTech::Config::Calendars
- Defined in:
- lib/bibliotech/config/schedule.rb
Constant Summary
Constants inherited from Schedules
Schedules::SCHEDULE_SHORTHANDS
Instance Attribute Summary
Attributes inherited from Schedules
Instance Method Summary collapse
- #build_scheduler(frequency, schedule_pattern, limit) ⇒ Object
- #config_hash ⇒ Object
- #regularize_schedule(freq) ⇒ Object
Methods inherited from Schedules
#backup_frequency, #get_config_hash, #initialize, #regularize_frequency, #schedules
Constructor Details
This class inherits a constructor from BiblioTech::Config::Schedules
Instance Method Details
#build_scheduler(frequency, schedule_pattern, limit) ⇒ Object
125 126 127 |
# File 'lib/bibliotech/config/schedule.rb', line 125 def build_scheduler(frequency, schedule_pattern, limit) Backups::CalendarScheduler.new(schedule_pattern, limit) end |
#config_hash ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/bibliotech/config/schedule.rb', line 89 def config_hash hash = {} config.optionally{ hash = get_config_hash(:prune_calendar) } [:quarterly, :quarterlies, "quarterly", "quarterlies"].each do |qkey| limit = hash.delete(qkey) if limit hash.merge!( :first_quarter => limit, :second_quarter => limit, :third_quarter => limit, :fourth_quarter => limit ) end end hash end |
#regularize_schedule(freq) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/bibliotech/config/schedule.rb', line 106 def regularize_schedule(freq) case freq when Array freq when "daily", "dailies", :daily, :dailies [ 0, 00 ] when "monthly", "monthlies", :monthly, :monthlies [ 1, 0, 00 ] # on the 1st, at 0:00 when "first_quarter", "first-quarter", :first_quarter [ 1, 1, 0, 00 ] # on the 1st of Jan, at 0:00 when "second_quarter", "second-quarter", :second_quarter [ 4, 1, 0, 00 ] # on the 1st of Apr, at 0:00 when "third_quarter", "third-quarter", :third_quarter [ 7, 1, 0, 00 ] # on the 1st of Jul, at 0:00 when "fourth_quarter", "fourth-quarter", :fourth_quarter [ 10, 1, 0, 00 ] # on the 1st of Oct, at 0:00 end end |