Class: BootPolish::DefaultRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/boot_polish/default_renderer.rb

Instance Method Summary collapse

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

#ascendObject



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

#descendObject



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.message}\n"
end