Method: Object::WithBenchmark::BenchmarkProxy#method_missing

Defined in:
lib/vex/base/object/with_benchmark.rb

#method_missing(*args, &block) ⇒ Object (private)



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/vex/base/object/with_benchmark.rb', line 31

def method_missing(*args, &block)
  result = ex = nil

  realtime = Benchmark.realtime do
    begin
      result = @host.__send__(*args, &block)
    rescue
      ex = $!
    end
  end

  msg = "#{@label || "benchmarked"}: #{ex && "EXCEPTION #{ex} after "}#{"%.2f secs" % realtime}"

  report(msg)

  raise ex if ex
  result
end