class Bundler::Graph

def _patching_gem_dependency_class

def _patching_gem_dependency_class
  # method borrow from rubygems/dependency.rb
  # redefinition of matching_specs will also redefine to_spec and to_specs
  Gem::Dependency.class_eval do
    def matching_specs platform_only = false
      matches = Bundler.load.specs.select { |spec|
        self.name == spec.name and
          requirement.satisfied_by? spec.version
      }
      if platform_only
        matches.reject! { |spec|
          not Gem::Platform.match spec.platform
        }
      end
      matches = matches.sort_by { |s| s.sort_obj } # HACK: shouldn't be needed
    end
  end
end