Module: MonthValue
Instance Method Summary collapse
Instance Method Details
#month_value(str) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/zones.rb', line 4 def month_value(str) (val = str.to_i).zero? ? (@month_value ||= { "jan" => 1, "january" => 1, "jul" => 7, "july" => 7, "feb" => 2, "february" => 2, "aug" => 8, "august" => 8, "mar" => 3, "march" => 3, "sep" => 9, "september" => 9, "apr" => 4, "april" => 4, "oct" => 10, "october" => 10, "may" => 5, "nov" => 11, "november" => 11, "jun" => 6, "june" => 6, "dec" => 12, "december" => 12, })[str.downcase] : val or raise "bad month: #{str}" end |