lib/common/benchmarking.rb in liri-0.3.1 vs lib/common/benchmarking.rb in liri-0.4.0
- old
+ new
@@ -2,18 +2,12 @@
# = benchmarking.rb
#
# @author Rodrigo Fernández
-require 'benchmark'
-require 'i18n' # requerimiento de la gema to_duration
-require 'to_duration'
+require "benchmark"
-# Se configura la ubicación del archivo de internacionalización de la gema to_duration
-I18n.load_path << Dir["#{File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'config/locales')}/*.yml"]
-I18n.default_locale = :es
-
module Liri
module Common
# == Módulo Benchmarking
# Este módulo se encarga de medir el tiempo de ejecución de algunos bloques de código
module Benchmarking
@@ -21,10 +15,10 @@
def start(start_msg: nil, end_msg: 'Duration: ', stdout: true, &block)
Liri.logger.info(start_msg, stdout)
seconds = Benchmark.realtime(&block)
- Liri.logger.info("#{end_msg}#{seconds.to_duration}", stdout)
+ Liri.logger.info("#{end_msg}#{Duration.humanize(seconds, times_round: Liri.times_round, times_round_type: Liri.times_round_type)}", stdout)
seconds
end
end
end
end