This is the latest version I've been monkeypatching with:
class Gem::SourceIndex
alias :dead_latest_specs :latest_specs
def latest_specs
result, latest = Hash.new { |h,k| h[k] = [] }, {}
each do |full_name, spec|
name = spec.name
curr = spec.version
prev = latest[name] || curr
next unless curr >= prev
if curr > prev then
result[name].clear
latest[name] = curr
end
result[name] << spec
end
result
end
end
Seems to work well, tho it returns a different structure than before.
It seems to work pretty well. I'm pretty sure that latest_specs is
only used sparingly within (if at all) and other than that, I think
I'm the only external client of this method (at least, of the actual
values of the hash).
_______________________________________________
Rubygems-developers mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rubygems-developers