Class: WhyChain::Explainer
- Inherits:
-
Object
- Object
- WhyChain::Explainer
- Defined in:
- lib/why_chain/explainer.rb
Overview
Formats a human-friendly runtime dispatch explanation.
Instance Method Summary collapse
-
#initialize(trace, method_name) ⇒ Explainer
constructor
A new instance of Explainer.
- #to_s ⇒ Object
Constructor Details
#initialize(trace, method_name) ⇒ Explainer
Returns a new instance of Explainer.
6 7 8 9 |
# File 'lib/why_chain/explainer.rb', line 6 def initialize(trace, method_name) @trace = trace @method_name = method_name end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/why_chain/explainer.rb', line 11 def to_s lines = ["Ruby dispatch explanation for :#{@method_name}", ""] explanation_steps.each_with_index do |step, index| lines.concat(step_lines(step, index)) end lines.join("\n") end |