module TimeDateComparison
Provides comparison operator extensions.
Definitions
def <=>(other)
Compare a time with a date-like or otherwise comparable value.
Signature
-
parameter
otherObject The object to compare.
-
returns
Integer | Nil The comparison result.
Implementation
def <=>(other)
if Date === other or DateTime === other
self.to_datetime <=> other
else
super
end
end