Class: Facter::Framework::Benchmarking::Timer

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/framework/benchmarking/timer.rb

Class Method Summary collapse

Class Method Details

.measure(fact_name) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/facter/framework/benchmarking/timer.rb', line 10

def measure(fact_name)
  if Options[:timing]
    time = Benchmark.measure { yield }

    puts "fact `#{fact_name}`, took: #{time.format('%r')} seconds"
  else
    yield
  end
end