K
Kev Jackson
is caller the best way to access the name of the current method?
ie if I have a method called x, is there any other way to determine at
runtime the exact method that is executing? caller would return an
array (limited by the int param) of the call stack, but I'd still have
to search across the array (with a regexp) to extract the method name
with caller I can do something like...
ms = ["prog:1:in `x'"]
ms.each { |m| /x/=~m do_stuff }
Is there no other way? no Kernel.running_method, no Kernel.executing?
Are there any libraries that would give me this level of inspection
without extending Kernel? (I'm thinking of evil.rb here)
No biggy, just interested if anyone else has ever wanted/needed to get
this info in a running program, and what they did to do it
Kev
ie if I have a method called x, is there any other way to determine at
runtime the exact method that is executing? caller would return an
array (limited by the int param) of the call stack, but I'd still have
to search across the array (with a regexp) to extract the method name
with caller I can do something like...
ms = ["prog:1:in `x'"]
ms.each { |m| /x/=~m do_stuff }
Is there no other way? no Kernel.running_method, no Kernel.executing?
Are there any libraries that would give me this level of inspection
without extending Kernel? (I'm thinking of evil.rb here)
No biggy, just interested if anyone else has ever wanted/needed to get
this info in a running program, and what they did to do it
Kev