module Seasonal

Constants

CA
TX
VERSION

Public Instance Methods

get_season(date) click to toggle source
# File lib/seasonal.rb, line 14
def get_season(date)
  case
  when date.month <= 3
    :winter
  when date.month <= 6
    :spring
  when date.month <= 9
    :summer
  else
    :fall
  end
end
in_season?(date, state) click to toggle source
# File lib/seasonal.rb, line 7
def in_season?(date, state)
  season = get_season(date)
  state = string_to_constant(state)

  state[season].include? name
end
string_to_constant(string) click to toggle source
# File lib/seasonal.rb, line 27
def string_to_constant(string)
  Seasonal.const_get(string)
end