Class: WhyChain::Explainer::TeachingFormatter
- Inherits:
-
Object
- Object
- WhyChain::Explainer::TeachingFormatter
- Defined in:
- lib/why_chain/explainer/teaching_formatter.rb
Overview
Verbose didactic explanation format.
Instance Method Summary collapse
-
#initialize(method_name, steps, graph, colorizer) ⇒ TeachingFormatter
constructor
A new instance of TeachingFormatter.
- #render ⇒ Object
Constructor Details
#initialize(method_name, steps, graph, colorizer) ⇒ TeachingFormatter
Returns a new instance of TeachingFormatter.
7 8 9 10 11 12 |
# File 'lib/why_chain/explainer/teaching_formatter.rb', line 7 def initialize(method_name, steps, graph, colorizer) @method_name = method_name @steps = steps @graph = graph @colorizer = colorizer end |
Instance Method Details
#render ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/why_chain/explainer/teaching_formatter.rb', line 14 def render lines = [@colorizer.colorize("Ruby dispatch explanation for :#{@method_name}", :title), ""] @steps.each_with_index do |step, index| lines.concat(step_lines(step, index)) end lines.join("\n") end |