Class: Backup::DateParser
- Inherits:
-
Object
- Object
- Backup::DateParser
- Defined in:
- lib/backup/date_parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#date_from(what) ⇒ Object
the test is going to be whatever is returned here .include? the day of today.
Class Method Details
.date_from(what) ⇒ Object
4 5 6 |
# File 'lib/backup/date_parser.rb', line 4 def self.date_from(what) DateParser.new.date_from(what) end |
Instance Method Details
#date_from(what) ⇒ Object
the test is going to be whatever is returned here .include? the day of today. so if we want to do something every day than this needs to return something that will lincde the righ daY:W
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/backup/date_parser.rb', line 11 def date_from(what) if what.kind_of?(Symbol) return Runt::DIWeek.new( Time.num_from_day(what) ) if day_of_week?(what) return Runt::REDay.new(0,0,24,01) if what == :daily if what.to_s =~ /^last_/ what.to_s =~ /^last_(\w+)_of_the_month$/ day = $1 return Runt::DIMonth.new(Runt::Last, Time.num_from_day(day.intern)) end end raise "#{what} is not a valid time" unless what.respond_to?(:include?) what end |