Class: Solve::Tracers::HumanReadable

Inherits:
AbstractTracer show all
Extended by:
Forwardable
Defined in:
lib/solve/tracers/human_readable.rb

Constant Summary

Constants inherited from AbstractTracer

AbstractTracer::TRACER_METHODS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ui) ⇒ HumanReadable

Returns a new instance of HumanReadable.

Parameters:

  • ui (#say)


11
12
13
# File 'lib/solve/tracers/human_readable.rb', line 11

def initialize(ui)
  @ui = ui
end

Instance Attribute Details

#uiObject (readonly)

Returns the value of attribute ui.



6
7
8
# File 'lib/solve/tracers/human_readable.rb', line 6

def ui
  @ui
end

Instance Method Details

#add_constraint(dependency, source) ⇒ Object



46
47
48
# File 'lib/solve/tracers/human_readable.rb', line 46

def add_constraint(dependency, source)
  say("Adding constraint #{dependency.name} #{dependency.constraint} from #{source.to_s}")
end

#backtrack(unbound_variable) ⇒ Object



33
34
35
# File 'lib/solve/tracers/human_readable.rb', line 33

def backtrack(unbound_variable)
  say("Could not find an acceptable value for #{unbound_variable.artifact.to_s}")
end

#cannot_backtrackObject



37
38
39
# File 'lib/solve/tracers/human_readable.rb', line 37

def cannot_backtrack
  say("Cannot backtrack any further")
end

#possible_values(possible_values) ⇒ Object



25
26
27
# File 'lib/solve/tracers/human_readable.rb', line 25

def possible_values(possible_values)
  say("Possible values are #{possible_values.map(&:to_s).join("\n\t")}")
end

#remove_constraint(constraint) ⇒ Object



62
63
64
# File 'lib/solve/tracers/human_readable.rb', line 62

def remove_constraint(constraint)
  say("Removed constraint #{constraint.name} #{constraint.constraint}")
end

#remove_variable(variable) ⇒ Object



58
59
60
# File 'lib/solve/tracers/human_readable.rb', line 58

def remove_variable(variable)
  say("Removed variable #{variable.artifact.to_s}")
end

#reset_domain(variable) ⇒ Object



50
51
52
# File 'lib/solve/tracers/human_readable.rb', line 50

def reset_domain(variable)
  say("Resetting possible values for #{variable.artifact.to_s}")
end

#searching_for(unbound_variable, constraints, possible_values) ⇒ Object



19
20
21
22
23
# File 'lib/solve/tracers/human_readable.rb', line 19

def searching_for(unbound_variable, constraints, possible_values)
  say("Searching for a value for #{unbound_variable.artifact}")
  say("Constraints are #{constraints.join("\n\t")}")
  possible_values(possible_values)
end

#solution(solution) ⇒ Object



41
42
43
44
# File 'lib/solve/tracers/human_readable.rb', line 41

def solution(solution)
  say("Found Solution")
  say(solution)
end

#startObject



15
16
17
# File 'lib/solve/tracers/human_readable.rb', line 15

def start
  say("Attempting to find a solution")
end

#trying(artifact) ⇒ Object



29
30
31
# File 'lib/solve/tracers/human_readable.rb', line 29

def trying(artifact)
  say("Attempting to use #{artifact.to_s}")
end

#unbind(variable) ⇒ Object



54
55
56
# File 'lib/solve/tracers/human_readable.rb', line 54

def unbind(variable)
  say("Unbinding #{variable.artifact.to_s}")
end