Module: Liri::Common::Benchmarking

Defined in:
lib/common/benchmarking.rb

Class Method Summary collapse

Class Method Details

.start(start_msg: nil, end_msg: 'Duración: ', stdout: true) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/common/benchmarking.rb', line 20

def start(start_msg: nil, end_msg: 'Duración: ', stdout: true)
  Liri.logger.info(start_msg, stdout)
  seconds = Benchmark.realtime do
    yield
  end
  Liri.logger.info("#{end_msg}#{seconds.to_duration}", stdout)
  seconds
end