diff options
Diffstat (limited to 'lib/tracer.rb')
-rw-r--r-- | lib/tracer.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb index b1f08f3f68..4b2429508d 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -287,7 +287,12 @@ if $0 == __FILE__ ARGV.shift Tracer.on require $0 -elsif caller.count {|bt| /\/rubygems\/custom_require.rb:/ !~ bt} <= 1 - Tracer.on +else + # call Tracer.on only if required by -r command-line option + count = caller.count {|bt| /\/rubygems\/custom_require.rb:/ !~ bt} + if (defined?(Gem) and count == 0) or + (!defined?(Gem) and count <= 1) + Tracer.on + end end # :startdoc: |