Class: RailsConsolePro::Printers::SnippetPrinter
- Inherits:
-
BasePrinter
- Object
- BasePrinter
- RailsConsolePro::Printers::SnippetPrinter
- Defined in:
- lib/rails_console_pro/printers/snippet_printer.rb
Overview
Printer for individual snippet results
Instance Attribute Summary
Attributes inherited from BasePrinter
#output, #pry_instance, #value
Instance Method Summary collapse
Methods inherited from BasePrinter
Methods included from ColorHelper
#bold_color, #color, #method_missing, #pastel, #respond_to_missing?
Constructor Details
This class inherits a constructor from RailsConsolePro::BasePrinter
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsConsolePro::ColorHelper
Instance Method Details
#print ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rails_console_pro/printers/snippet_printer.rb', line 7 def print result = value snippet = result.snippet border header_text = header_title(result) output.puts bold_color(config.get_color(:header), header_text) border output.puts (snippet, result) output.puts snippet.body.each_line.with_index(1) do |line, number| output.puts format_line(number, line) end border output.puts result. if result. border snippet end |