Created
June 6, 2013 21:18
-
-
Save joegiralt/5725043 to your computer and use it in GitHub Desktop.
just a matter of time
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
def seconds_in_minutes(oneminute = 1) | |
60 * oneminute #=> 60 | |
end | |
def minutes_in_hours(onehour = 1) | |
60 * onehour #=> 60 | |
end | |
def hours_in_days(oneday = 1) | |
24 * oneday #=> 24 | |
end | |
def days_in_weeks(oneweek = 1) | |
7 * oneweek | |
end #=> 7 | |
def weeks_in_years(oneyear = 1) | |
52 * oneyear #=> 52 | |
end | |
def age_from_seconds(seconds) | |
seconds / seconds_in_minutes / minutes_in_hours / hours_in_days / days_in_weeks / weeks_in_years | |
end | |
age_from_seconds(1111000000) | |
def hours_in_year(oneyear = 1) | |
oneyear * hours_in_days * days_in_weeks * weeks_in_years | |
end | |
hours_in_year | |
def minutes_in_decade(onedecade = 1) | |
onedecade * 10 * weeks_in_years * days_in_weeks * hours_in_days * minutes_in_hours | |
end | |
minutes_in_decade | |
def age_in_seconds(age = 28) # I'm 28! | |
age * seconds_in_minutes * minutes_in_hours * hours_in_days * days_in_weeks * weeks_in_years | |
end | |
age_in_seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment