lib/arborist/mixins.rb in arborist-0.1.0 vs lib/arborist/mixins.rb in arborist-0.2.0.pre20170519125456
- old
+ new
@@ -124,10 +124,19 @@
end # module TimeFunctions
# Refinements to Numeric and Time to add convenience methods
module TimeRefinements
+
+ # Approximate Time Constants (in seconds)
+ MINUTES = 60
+ HOURS = 60 * MINUTES
+ DAYS = 24 * HOURS
+ WEEKS = 7 * DAYS
+ MONTHS = 30 * DAYS
+ YEARS = 365.25 * DAYS
+
refine Numeric do
### Number of seconds (returns receiver unmodified)
def seconds
return self
@@ -205,18 +214,9 @@
end # refine Numeric
refine Time do
-
- # Approximate Time Constants (in seconds)
- MINUTES = 60
- HOURS = 60 * MINUTES
- DAYS = 24 * HOURS
- WEEKS = 7 * DAYS
- MONTHS = 30 * DAYS
- YEARS = 365.25 * DAYS
-
### Returns +true+ if the receiver is a Time in the future.
def future?
return self > Time.now
end