instance method minus_with_coercion

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

minus_with_coercion(other)

Time#- can also be used to determine the number of seconds between two Time instances. We’re layering on additional behavior so that ActiveSupport::TimeWithZone instances are coerced into values that Time#- will recognize

Parameters

other req
Source
# File activesupport/lib/active_support/core_ext/time/calculations.rb, line 293
        def minus_with_coercion(other)
          other = other.comparable_time if other.respond_to?(:comparable_time)
          other.is_a?(::DateTime) ? to_f - other.to_f : minus_without_coercion(other)
        end

Defined in activesupport/lib/active_support/core_ext/time/calculations.rb line 293 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::CoreExtensions::Time::Calculations

Type at least 2 characters to search.

↑↓ navigate · open · esc close