R
Ronald Fischer
Is there away to access the name of the currently defined function?
Example: Right now I do tracing like this:
def myfunc(a,b)=20
trace.debug "ENTER myfunc a=3D#{a} b=3D#{b}"
....
trace.debug "LEAVE myfunc result=3D#{result}"
result
end
If I rename myfunc, I also have to change the word myfunc in the
trace statements. It would be convenient to have something like
trace.debug "ENTER #{__function__} a=3D#{a} b=3D#{b}"
Maybe Ruby already provides such a feature, and I just don't know it...
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
Example: Right now I do tracing like this:
def myfunc(a,b)=20
trace.debug "ENTER myfunc a=3D#{a} b=3D#{b}"
....
trace.debug "LEAVE myfunc result=3D#{result}"
result
end
If I rename myfunc, I also have to change the word myfunc in the
trace statements. It would be convenient to have something like
trace.debug "ENTER #{__function__} a=3D#{a} b=3D#{b}"
Maybe Ruby already provides such a feature, and I just don't know it...
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162