module UnionStationHooksRails::ActiveSupportBenchmarkableExtension

Public Instance Methods

benchmark_with_union_station(message = 'Benchmarking', *args) { || ... } click to toggle source
# File lib/union_station_hooks_rails/active_support_benchmarkable_extension.rb, line 27
def benchmark_with_union_station(message = 'Benchmarking', *args)
  reporter = Thread.current[:union_station_hooks]
  if reporter
    reporter.log_benchmark_block(message) do
      benchmark_without_union_station(message, *args) do
        yield
      end
    end
  else
    benchmark_without_union_station(message, *args) do
      yield
    end
  end
end