End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Gem::Source#<=>
<=>(other)
lib/rubygems/source.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/rubygems/source.rb, line 43
def <=>(other)
case other
when Gem::Source::Installed,
Gem::Source::Local,
Gem::Source::Lock,
Gem::Source::SpecificFile,
Gem::Source::Git,
Gem::Source::Vendor then
-1
when Gem::Source then
if !@uri
return 0 unless other.uri
return 1
end
return -1 if !other.uri
# Returning 1 here ensures that when sorting a list of sources, the
# original ordering of sources supplied by the user is preserved.
return 1 unless @uri.to_s == other.uri.to_s
0
else
nil
end
end
Sources are ordered by installation preference.