Created
January 8, 2015 13:10
-
-
Save ecleel/b23fa85ec3cadf91ecee to your computer and use it in GitHub Desktop.
Season Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
def season(date) | |
case date.yday | |
when 80..202 then "Spring" | |
when 203..264 then "Summer" | |
when 265..355 then "Autumn" | |
else | |
"Winter" | |
end | |
end | |
puts season(Date.today) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment