class Time

def compare_with_coercion(other)

Experimental RBS support (using type sampling data from the type_fusion project).

def compare_with_coercion: (Time other) -> Integer

This signature was generated using 3 samples from 2 applications.

can be chronologically compared with a Time
Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
def compare_with_coercion(other)
  # we're avoiding Time#to_datetime and Time#to_time because they're expensive
  if other.class == Time
    compare_without_coercion(other)
  elsif other.is_a?(Time)
    compare_without_coercion(other.to_time)
  else
    to_datetime <=> other
  end
end