instance method
compare_with_coercion
Ruby on Rails 4.1.16
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 134
def compare_with_coercion(other)
if other.is_a?(Time)
self.to_datetime <=> other
else
compare_without_coercion(other)
end
end
Defined in activesupport/lib/active_support/core_ext/date/calculations.rb line 134
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Date