Module: Kernel

Defined in:
lib/require_bench.rb

Overview

A Kernel hack that adds require timing to find require problems in app.

Instance Method Summary collapse

Instance Method Details

#require(file) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/require_bench.rb', line 48

def require(file)
  file = file.to_s

  # Global $ variable, which is always truthy while inside the hack, is to
  #   prevent a scenario that might result in infinite recursion.
  return require_without_timing(file) if $require_bench_semaphore
  if RequireBench::SKIP_PATTERN && file =~ RequireBench::SKIP_PATTERN
    return require_without_timing(file)
  end

  RequireBench.require_with_timing(file)
end

#require_without_timing ⇒ Object



46
# File 'lib/require_bench.rb', line 46

alias require_without_timing require