Sha256: 7dbb241bfbe4a2e603125a957e154119b6d4c383da24a691a6045f6c20dfb633

Contents?: true

Size: 329 Bytes

Versions: 5

Compression:

Stored size: 329 Bytes

Contents

require 'benchmark'

module NagiosCheck
  module Chronometer
    def time(opts = {}, &block)
      raise ArgumentError, "block is mandatory for method time" if block.nil?
      time = Benchmark.realtime { block.call }
      if opts[:value_name]
        store_value(opts[:value_name], time)
      end
      time
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nagios_check-0.4.1 lib/nagios_check/chronometer.rb
nagios_check-0.4.0 lib/nagios_check/chronometer.rb
nagios_check-0.3.1 lib/nagios_check/chronometer.rb
nagios_check-0.3.0 lib/nagios_check/chronometer.rb
nagios_check-0.2.0 lib/nagios_check/chronometer.rb