summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 15:26:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-02-17 15:26:34 +0000
commit8ba6fcc70cf7d3f21d3db32d7ed21b2b19aa814a (patch)
tree7bb65a2623daf6768095b343c59a26ba407289cd /lib
parent1b013d7dd5c37eddcd8076e068c6b8af93725868 (diff)
* lib/tracer.rb: merged a minor clarification patch from Daniel
Berger <Daniel.Berger at qwest.com>. [ruby-core:07376] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/tracer.rb23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/tracer.rb b/lib/tracer.rb
index 3ccf1b5017..893a9d5827 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -24,8 +24,6 @@ class Tracer
attr :stdout, true
end
- MY_FILE_NAME = caller(0)[0].scan(/^(.*):[0-9]+$/)[0][0]
-
EVENT_SYMBOL = {
"line" => "-",
"call" => ">",
@@ -97,6 +95,7 @@ class Tracer
SCRIPT_LINES__[file] = list = []
end
end
+
if l = list[line - 1]
l
else
@@ -113,7 +112,7 @@ class Tracer
end
def trace_func(event, file, line, id, binding, klass, *)
- return if file == MY_FILE_NAME
+ return if file == __FILE__
for p in @filters
return unless p.call event, file, line, id, binding, klass
@@ -156,15 +155,13 @@ end
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
-if caller(0).size == 1
- if $0 == Tracer::MY_FILE_NAME
- # direct call
+if $0 == __FILE__
+ # direct call
- $0 = ARGV[0]
- ARGV.shift
- Tracer.on
- require $0
- else
- Tracer.on
- end
+ $0 = ARGV[0]
+ ARGV.shift
+ Tracer.on
+ require $0
+else
+ Tracer.on
end