class Gem::Dependency
def to_spec
def to_spec matches = to_specs.compact active = matches.find(&:activated?) return active if active unless prerelease? # Consider prereleases only as a fallback pre, matches = matches.partition {|spec| spec.version.prerelease? } matches = pre if matches.empty? end matches.first end