Method: Integer#years

Defined in:
lib/active_support/core_ext/integer/time.rb

#yearsObject Also known as: year

Returns a Duration instance matching the number of years provided.

2.years # => 2 years


18
19
20
# File 'lib/active_support/core_ext/integer/time.rb', line 18

def years
  ActiveSupport::Duration.years(self)
end