Froze rails gems
[depot.git] / vendor / rails / activesupport / lib / active_support / core_ext / float / time.rb
1 module ActiveSupport #:nodoc:
2 module CoreExtensions #:nodoc:
3 module Float #:nodoc:
4 module Time
5 # Deprication helper methods not available as core_ext is loaded first.
6 def years
7 ::ActiveSupport::Deprecation.warn(self.class.deprecated_method_warning(:years, "Fractional years are not respected. Convert value to integer before calling #years."), caller)
8 years_without_deprecation
9 end
10 def months
11 ::ActiveSupport::Deprecation.warn(self.class.deprecated_method_warning(:months, "Fractional months are not respected. Convert value to integer before calling #months."), caller)
12 months_without_deprecation
13 end
14
15 def months_without_deprecation
16 ActiveSupport::Duration.new(self * 30.days, [[:months, self]])
17 end
18 alias :month :months
19
20 def years_without_deprecation
21 ActiveSupport::Duration.new(self * 365.25.days, [[:years, self]])
22 end
23 alias :year :years
24 end
25 end
26 end
27 end