Class: Gem::Resolver::Molinillo::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb,
lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb

Overview

This class encapsulates a dependency resolver. The resolver is responsible for determining which set of dependencies to activate, with feedback from the #specification_provider

Defined Under Namespace

Classes: Resolution

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specification_provider, resolver_ui) ⇒ Resolver

Initializes a new resolver.

Parameters:



26
27
28
29
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb', line 26

def initialize(specification_provider, resolver_ui)
  @specification_provider = specification_provider
  @resolver_ui = resolver_ui
end

Instance Attribute Details

#resolver_uiUI (readonly)

Returns the UI module used to communicate back to the user during the resolution process.

Returns:

  • (UI)

    the UI module used to communicate back to the user during the resolution process



19
20
21
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb', line 19

def resolver_ui
  @resolver_ui
end

#specification_providerSpecificationProvider (readonly)

Returns the specification provider used in the resolution process.

Returns:



15
16
17
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb', line 15

def specification_provider
  @specification_provider
end

Instance Method Details

#resolve(requested, base = DependencyGraph.new) ⇒ Object

Resolves the requested dependencies into a DependencyGraph, locking to the base dependency graph (if specified)

Parameters:

  • requested (Array)

    an array of ‘requested’ dependencies that the #specification_provider can understand

  • base (DependencyGraph, nil) (defaults to: DependencyGraph.new)

    the base dependency graph to which dependencies should be ‘locked’



37
38
39
40
41
42
43
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolver.rb', line 37

def resolve(requested, base = DependencyGraph.new)
  Resolution.new(specification_provider,
                 resolver_ui,
                 requested,
                 base).
    resolve
end