summaryrefslogtreecommitdiff
path: root/lib/tracer.rb
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 13:19:59 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-29 13:19:59 +0000
commite31caff00eaef9237e5825a7e9ccdae80a6fecf0 (patch)
tree9059707f62b6ecf80abf4344a86ee9b005b7a607 /lib/tracer.rb
parentd073f1d53c9b72ab4fd1a02494999648c41b0868 (diff)
* lib/tracer.rb: Tracer.on only if required by -r command-line option.
and consider --disable-gems option. * test/test_tracer.rb: add tests for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tracer.rb')
-rw-r--r--lib/tracer.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb
index b1f08f3..4b24295 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: