blob: 5efb89cf9f8f55a0ba76ae1f613ace5304269c53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
require "active_support/duration"
require "active_support/core_ext/numeric/time"
class Integer
# Returns a Duration instance matching the number of months provided.
#
# 2.months # => 2 months
def months
ActiveSupport::Duration.months(self)
end
alias :month :months
# Returns a Duration instance matching the number of years provided.
#
# 2.years # => 2 years
def years
ActiveSupport::Duration.years(self)
end
alias :year :years
end
|