Sha256: 128ca685cb3d5b742f9adc11328abfe229851580e7827c880f820720c1bcb1f2
Contents?: true
Size: 882 Bytes
Versions: 1
Compression:
Stored size: 882 Bytes
Contents
require 'benchmark' module ActionLogic module ActionBenchmark module ClassMethods def with_benchmark(execution_context, &block) if benchmark? benchmark_result, context = benchmark!(&block) log!(benchmark_result, execution_context) context else block.call end end private def benchmark? ActionConfiguration.benchmark? end def benchmark!(&block) context = nil benchmark_result = Benchmark.measure { context = block.call } [benchmark_result, context] end def log!(benchmark_result, execution_context) benchmark_formatter.send(execution_context.__private__type, benchmark_result, execution_context.name) end def benchmark_formatter ActionConfiguration.benchmark_formatter end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
action_logic-0.2.4 | lib/action_logic/action_benchmark.rb |