Module: Solve

Defined in:
lib/solve.rb,
lib/solve/graph.rb,
lib/solve/demand.rb,
lib/solve/errors.rb,
lib/solve/solver.rb,
lib/solve/version.rb,
lib/solve/artifact.rb,
lib/solve/constraint.rb,
lib/solve/dependency.rb,
lib/solve/solver/serializer.rb

Defined Under Namespace

Modules: Errors Classes: Artifact, Constraint, Demand, Dependency, Graph, Solver

Constant Summary collapse

VERSION =
"1.2.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.tracerSolve::Formatter (readonly)

Returns:

  • (Solve::Formatter)


14
15
16
# File 'lib/solve.rb', line 14

def tracer
  @tracer
end

Class Method Details

.it!(graph, demands, options = {}) ⇒ Hash

A quick solve. Given the “world” as we know it (the graph) and a list of requirements (demands) which must be met. Return me the best solution of artifacts and verisons that I should use.

If a ui object is passed in, the resolution will be traced

Parameters:

  • graph (Solve::Graph)
  • demands (Array<Solve::Demand>, Array<String, String>)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :sorted (Boolean) — default: false

    should the output be a sorted list rather than a Hash

Returns:

  • (Hash)

Raises:

  • (NoSolutionError)


31
32
33
# File 'lib/solve.rb', line 31

def it!(graph, demands, options = {})
  Solver.new(graph, demands).resolve(options)
end