instance method
<=>
Ruby on Rails 4.2.9
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 183
def <=>(other)
if other.kind_of?(Infinity)
super
elsif other.respond_to? :to_datetime
super other.to_datetime rescue nil
else
nil
end
end
Defined in activesupport/lib/active_support/core_ext/date_time/calculations.rb line 183
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateTime