Class: BootPolish::DefaultRenderer
- Inherits:
-
Object
- Object
- BootPolish::DefaultRenderer
- Defined in:
- lib/boot_polish/default_renderer.rb
Instance Method Summary collapse
- #ascend ⇒ Object
- #benchmark(method, time) ⇒ Object
- #descend ⇒ Object
- #exception(method, exception) ⇒ Object
-
#initialize(output = nil) ⇒ DefaultRenderer
constructor
A new instance of DefaultRenderer.
Constructor Details
#initialize(output = nil) ⇒ DefaultRenderer
Returns a new instance of DefaultRenderer.
4 5 6 7 |
# File 'lib/boot_polish/default_renderer.rb', line 4 def initialize(output = nil) @output = output || STDOUT @indent = -1 end |
Instance Method Details
#ascend ⇒ Object
21 22 23 |
# File 'lib/boot_polish/default_renderer.rb', line 21 def ascend @indent -= 1 end |
#benchmark(method, time) ⇒ Object
17 18 19 |
# File 'lib/boot_polish/default_renderer.rb', line 17 def benchmark method, time @output << format("#{indent}%.4f for #{method}\n", time.real) end |
#descend ⇒ Object
9 10 11 |
# File 'lib/boot_polish/default_renderer.rb', line 9 def descend @indent += 1 end |
#exception(method, exception) ⇒ Object
13 14 15 |
# File 'lib/boot_polish/default_renderer.rb', line 13 def exception(method, exception) @output << "#{indent}#{method} raised #{exception.}\n" end |