Method: Date#compare_with_coercion

Defined in:
activesupport/lib/active_support/core_ext/date/calculations.rb

#compare_with_coercion(other) ⇒ Object Also known as: <=>

Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.



152
153
154
155
156
157
158
# 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