Class: DepSelector::Selector

Inherits:
Object
  • Object
show all
Defined in:
lib/dep_selector/selector.rb

Constant Summary collapse

DEFAULT_ERROR_REPORTER =
ErrorReporter::SimpleTreeTraverser.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dep_graph, error_reporter = DEFAULT_ERROR_REPORTER) ⇒ Selector

Returns a new instance of Selector.



36
37
38
39
# File 'lib/dep_selector/selector.rb', line 36

def initialize(dep_graph, error_reporter = DEFAULT_ERROR_REPORTER)
  @dep_graph = dep_graph
  @error_reporter = error_reporter
end

Instance Attribute Details

#dep_graphObject

Returns the value of attribute dep_graph.



32
33
34
# File 'lib/dep_selector/selector.rb', line 32

def dep_graph
  @dep_graph
end

#error_reporterObject

Returns the value of attribute error_reporter.



32
33
34
# File 'lib/dep_selector/selector.rb', line 32

def error_reporter
  @error_reporter
end

Instance Method Details

#find_solution(solution_constraints, valid_packages = nil) ⇒ Object



41
42
43
44
# File 'lib/dep_selector/selector.rb', line 41

def find_solution(solution_constraints, valid_packages = nil)
  result = Net::HTTP.post_form(URI('http://devmerlin:9292/'), {selector: self.to_yaml, solution_constraints: solution_constraints.to_yaml, valid_packages: valid_packages.to_yaml})
  JSON.parse(result.body)
end