class CronInfo::MonthOfYearParser

Public Instance Methods

label() click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 43
def label
  "month"
end
max_value() click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 39
def max_value
  12
end
min_value() click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 35
def min_value
  1
end
month_of_year_mappings() click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 3
def month_of_year_mappings
  {
    "jan" => 1,
    "feb" => 2,
    "mar" => 3,
    "apr" => 4,
    "may" => 5,
    "jun" => 6,
    "jul" => 7,
    "aug" => 8,
    "sep" => 9,
    "oct" => 10,
    "nov" => 11,
    "dec" => 12
  }
end
parse_word(cron_string) click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 28
def parse_word(cron_string)
  if month_of_year_mappings[cron_string.downcase] == nil
    raise "Invalid month of year argument #{cron_string}"
  end
  [month_of_year_mappings[cron_string.downcase]]
end
parse_word_range(cron_string) click to toggle source
# File lib/cron_info/month_of_year_parser.rb, line 20
def parse_word_range(cron_string)
  first_word, last_word = cron_string.split("-")
  if month_of_year_mappings[first_word.downcase] == nil || month_of_year_mappings[last_word.downcase] == nil
    raise "Invalid month of year word range argument #{cron_string}"
  end
  (month_of_year_mappings[first_word.downcase]..month_of_year_mappings[last_word.downcase]).to_a
end