Class: Benchin::Wrap::Report::NodePrinter Private
- Inherits:
-
Object
- Object
- Benchin::Wrap::Report::NodePrinter
- Defined in:
- lib/benchin/wrap/report/node_printer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Human readable Node printing.
With TTY colors.
Constant Summary collapse
- FIELD_SPACE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
14
- VALUE_SPACE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
7
- PRECISION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
3
Instance Method Summary collapse
-
#initialize(node, level: 0) ⇒ NodePrinter
constructor
private
A new instance of NodePrinter.
-
#to_s ⇒ String
private
Rendered report.
Constructor Details
#initialize(node, level: 0) ⇒ NodePrinter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of NodePrinter.
18 19 20 21 |
# File 'lib/benchin/wrap/report/node_printer.rb', line 18 def initialize(node, level: 0) @node = node @level = level end |
Instance Method Details
#to_s ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns rendered report.
24 25 26 27 28 29 30 31 |
# File 'lib/benchin/wrap/report/node_printer.rb', line 24 def to_s [ (@node.is_a?(Node::Virtual) ? virtual_body : body), @node.nested.values.map do |child_node| self.class.new(child_node, level: @level + 1).to_s end ].flatten.join("\n") end |