Created
April 29, 2014 16:15
-
-
Save lizmat/11404980 to your computer and use it in GitHub Desktop.
Duration primitives
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
sub term:<1sec>() { Duration.new(1) } | |
sub term:<1second>() { Duration.new(1) } | |
sub term:<1min>() { Duration.new(60) } | |
sub term:<1minute>() { Duration.new(60) } | |
sub term:<1hour>() { Duration.new( 60 * 60 ) } | |
sub term:<1day>() { Duration.new( 24 * 60 * 60 ) } | |
sub term:<1week>() { Duration.new( 7 * 24 * 60 * 60 ) } | |
sub postfix:<secs>($secs) { Duration.new($secs) } | |
sub postfix:<seconds>($seconds) { Duration.new($seconds) } | |
sub postfix:<mins>($mins) { Duration.new( 60 * $mins ) } | |
sub postfix:<minutes>($minutes) { Duration.new( 60 * $minutes ) } | |
sub postfix:<hours>($hours) { Duration.new( 60 * 60 * $hours ) } | |
sub postfix:<days>($days) { Duration.new( 24 * 60 * 60 * $days ) } | |
sub postfix:<weeks>($weeks) { Duration.new( 7 * 24 * 60 * 60 * $weeks ) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment