Method: Solve::GecodeSolver#resolve

Defined in:
lib/solve/gecode_solver.rb

#resolve(options = {}) ⇒ Hash, List

Returns a hash like { “Artifact Name” => “Version”,… } unless the :sorted option is true, then it returns a list like [[“Artifact Name”, “Version],…]

Options Hash (options):

  • :sorted (Boolean)

    return the solution as a sorted list instead of a Hash

Raises:



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/solve/gecode_solver.rb', line 69

def resolve(options = {})
  solution = solve_demands(demands_as_constraints)

  unsorted_solution = solution.inject({}) do |stringified_soln, (name, version)|
    stringified_soln[name] = version.to_s
    stringified_soln
  end

  if options[:sorted]
    build_sorted_solution(unsorted_solution)
  else
    unsorted_solution
  end
end