Class: Zold::VerboseThread

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/verbose_thread.rb

Overview

Verbose thread

Instance Method Summary collapse

Constructor Details

#initialize(log = Log::Quiet.new) ⇒ VerboseThread

Returns a new instance of VerboseThread.


31
32
33
# File 'lib/zold/verbose_thread.rb', line 31

def initialize(log = Log::Quiet.new)
  @log = log
end

Instance Method Details

#run(safe = false) ⇒ Object


35
36
37
38
39
40
# File 'lib/zold/verbose_thread.rb', line 35

def run(safe = false)
  yield
rescue StandardError => e
  @log.error(Backtrace.new(e).to_s)
  raise e unless safe
end