def self.scan_for_units(token)
{
/^years?$/ => :year,
/^seasons?$/ => :season,
/^months?$/ => :month,
/^fortnights?$/ => :fortnight,
/^weeks?$/ => :week,
/^weekends?$/ => :weekend,
/^(week|business)days?$/ => :weekday,
/^days?$/ => :day,
/^hrs?$/ => :hour,
/^hours?$/ => :hour,
/^mins?$/ => :minute,
/^minutes?$/ => :minute,
/^secs?$/ => :second,
/^seconds?$/ => :second
}.each do |item, symbol|
if item =~ token.word
klass_name = 'Repeater' + symbol.to_s.capitalize
klass = Chronic.const_get(klass_name)
return klass.new(symbol)
end
end
return nil
end