lib/facter/framework/benchmarking/timer.rb in facter-4.5.2 vs lib/facter/framework/benchmarking/timer.rb in facter-4.6.0

- old
+ new

@@ -5,12 +5,12 @@ module Facter module Framework module Benchmarking class Timer class << self - def measure(fact_name, prefix_message = '') + def measure(fact_name, prefix_message = '', &block) if Options[:timing] - time = Benchmark.measure { yield } + time = Benchmark.measure(&block) log = "fact '#{fact_name}', took: #{time.format('%r')} seconds" prefix_message = "#{prefix_message} " unless prefix_message.empty? puts "#{prefix_message}#{log}" else