From: wconrad@... Date: 2002-05-21T09:53:52+09:00 Subject: Re: what's the calling method name? On Mon, May 20, 2002 at 02:07:23PM +0900, Yohanes Santoso wrote: > wconrad@yagni.com writes: > > > There is an experimental patch at > > http://yagni.com/stack_frames/index.php that lets you find out the > > caller's class. It's against Ruby 1.6.5; let me know if it won't > > apply to whatever later version of Ruby you're using and I'll fix it > > up. > > > > ... > but I experienced some problem when incorporating it into my code: > jenny:/tmp2/freeride> ruby -v > ruby 1.6.7 (2002-03-01) [i686-linux] > > jenny:/tmp2/freeride> ./run.bat > ./plugins/remacs/documentation.rb:34:in `stack_frames'(DocumentationTestClass): NULL pointer given (ArgumentError) > from ./plugins/remacs/documentation.rb:34:in `insert_via_stack_frame' > from ./plugins/remacs/documentation.rb:131:in `test_insert_with_info_from_stack_frames' > from ./freebase/databus.rb:697 > > The corresponding code is: > > 32 def insert_via_stack_frame(doc) > 33 begin > 34 caller = stack_frames[1] > 35 #puts $STDERR, caller.class > 36 #puts $STDERR, caller.function > 37 #puts $STDERR, doc > 38 insert(caller.class, caller.function, doc) > 39 rescue NameError > 40 @bus["/log/error"] << "Trying to use the single-argument Documentation::insert without patching ruby" > 41 @bus["/log/error"] << $! > 42 puts $STDERR, $! > 43 end > 44 end Yohanes, I am unable to reproduce the problem. Do you have complete code you can send me that causes this error? Wayne Conrad