instance method
compare_with_coercion
Ruby on Rails 8.1.2
Since v4.0.13Signature
compare_with_coercion(other)
Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
Parameters
-
otherreq
Source
# File activesupport/lib/active_support/core_ext/date/calculations.rb, line 152
def compare_with_coercion(other)
if other.is_a?(Time)
to_datetime <=> other
else
compare_without_coercion(other)
end
end
Defined in activesupport/lib/active_support/core_ext/date/calculations.rb line 152
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Date