APIdock / Ruby
/
Browse About
method

sort_dependencies

ruby latest stable - Class: Gem::Resolver::Molinillo::SpecificationProvider
sort_dependencies(dependencies, activated, conflicts)
public

Sort dependencies so that the ones that are easiest to resolve are first. Easiest to resolve is (usually) defined by:

1) Is this dependency already activated?
2) How relaxed are the requirements?
3) Are there any conflicts for this dependency?
4) How many possibilities are there to satisfy this dependency?

@param [Array] dependencies @param [DependencyGraph] activated the current dependency graph in the

resolution process.

@param [{String => Array}] conflicts @return [Array] a sorted copy of `dependencies`.

# File lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb, line 81
    def sort_dependencies(dependencies, activated, conflicts)
      dependencies.sort_by do |dependency|
        name = name_for(dependency)
        [
          activated.vertex_named(name).payload ? 0 : 1,
          conflicts[name] ? 0 : 1,
        ]
      end
    end

Related methods

  • Instance methods
  • allow_missing?
  • dependencies_for
  • name_for
  • name_for_explicit_dependency_source
  • name_for_locking_dependency_source
  • requirement_satisfied_by?
  • search_for
  • sort_dependencies
APIdock API Documentation Browser

© 2026 APIdock