lib/solve/solver/serializer.rb in solve-0.4.4 vs lib/solve/solver/serializer.rb in solve-0.5.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'json'
+
module Solve
class Solver
class Serializer
# @param [Solve::Solver] solver
#
@@ -44,32 +46,32 @@
def format_artifact(artifact)
dependencies = artifact.dependencies.inject([]) do |list, dependency|
list << format_dependency(dependency)
end
- {
+ {
"name" => artifact.name,
"version" => artifact.version.to_s,
"dependencies" => dependencies
}
end
def format_dependency(dependency)
- {
- "name" => dependency.name,
+ {
+ "name" => dependency.name,
"constraint" => dependency.constraint.to_s
}
end
def format_demands(demands)
- demands_list = demands.inject([]) do |list, demand|
- list << format_demand(demand)
+ demands_list = demands.inject([]) do |list, demand|
+ list << format_demand(demand)
end
{ "demands" => demands_list }
end
def format_demand(demand)
- {
+ {
"name" => demand.name,
"constraint" => demand.constraint.to_s
}
end