instance method
compare_with_coercion
Ruby on Rails 3.2.22.5
Since v3.0.20Signature
compare_with_coercion(other)
Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances can be chronologically compared with a Time
Parameters
-
otherreq
Source
# File activesupport/lib/active_support/core_ext/time/calculations.rb, line 357
def compare_with_coercion(other)
# we're avoiding Time#to_datetime cause it's expensive
other.is_a?(Time) ? compare_without_coercion(other.to_time) : to_datetime <=> other
end
Defined in activesupport/lib/active_support/core_ext/time/calculations.rb line 357
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Time