instance method
<=>
Ruby on Rails 6.1.7.10
Since v3.0.20Signature
<=>(other)
Layers additional behavior on DateTime#<=> so that Time and ActiveSupport::TimeWithZone instances can be compared with a DateTime.
Parameters
-
otherreq
Source
# File activesupport/lib/active_support/core_ext/date_time/calculations.rb, line 204
def <=>(other)
if other.respond_to? :to_datetime
super other.to_datetime rescue nil
else
super
end
end
Defined in activesupport/lib/active_support/core_ext/date_time/calculations.rb line 204
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateTime