Created
December 20, 2013 18:30
-
-
Save AKovtunov/8059194 to your computer and use it in GitHub Desktop.
Ruby SpeedSheet
This file contains hidden or 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
years = (Date.strptime("2013","%Y").year...DateTime.now.year+5).to_a | |
months = (1..12).to_a.map!{|m| Date::MONTHNAMES[m]} | |
years_months_hash = years.inject({}){|hsh, year| hsh[year]=months; hsh} | |
#Will be {:2013=>["January", "Fabruary",..],..} | |
Date::MONTHNAMES.index(month) #month = "January" => 1 | |
Date::MONTHNAMES[m] #m = 1 => "January" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment