Module | ActiveSupport::CoreExtensions::Numeric::Time |
In: |
vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb
|
Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.
If you need precise date calculations that doesn‘t just treat months as 30 days, then have a look at Time#advance.
Some of these methods are approximations, Ruby‘s core Date and Time should be used for precision date and time arithmetic
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 29 29: def days 30: self * 24.hours 31: end
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 39 39: def fortnights 40: self * 2.weeks 41: end
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 24 24: def hours 25: self * 60.minutes 26: end
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 19 19: def minutes 20: self * 60 21: end
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 44 44: def months 45: self * 30.days 46: end
# File vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb, line 14 14: def seconds 15: self 16: end