Created
December 9, 2010 23:24
-
-
Save samullen/735500 to your computer and use it in GitHub Desktop.
Calculates seconds to more english friendly time periods (1 hour, 2 days, etc.)
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 calculate_seconds(period) | |
if period.match(/(\d+).+?(second|minute|hour|day|week|month|year)s?/) | |
$1.to_i.send($2) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment