From 3442be4e84eaebcd718c1ba5b89818830653dcb5 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 17 Feb 2006 15:40:32 +0000 Subject: * lib/tracer.rb: merged a minor clarification patch from Daniel Berger . [ruby-core:07376] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/tracer.rb | 22 +++++++++------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e98a8a428..4ca1a09e27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Feb 18 00:22:39 2006 Yukihiro Matsumoto + + * lib/tracer.rb: merged a minor clarification patch from Daniel + Berger . [ruby-core:07376] + Fri Feb 17 17:30:20 2006 Yukihiro Matsumoto * eval.c (ev_const_get): simplified using rb_const_get_fallback(). diff --git a/lib/tracer.rb b/lib/tracer.rb index c3f2fb8f2e..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" => ">", @@ -114,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 @@ -157,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 -- cgit v1.2.3