From: Gavin Sinclair Date: 2004-06-12T15:16:34+09:00 Subject: Any way to get the calling method's binding? Something I've wanted to do on a few occasions recently is to evaluate an expression in the context of the calling method. A simple example is this: def trace(expr, _binding) LOG.debug "#{expr} = #{eval expr, _binding)}" end def something x = 5 y = 7 trace "x + y", binding end The effect of calling something() now is that the message "x + y = 12" gets logged. It Would Be Nice if I could do this instead: def trace(expr) _binding = somehow_get_calling_methods_binding() LOG.debug "#{expr} = #{eval expr, _binding)}" end def something x = 5 y = 7 trace "x + y" end Is there a substitute for "somehow_get_calling_methods_binding()" in the code above? Thanks, Gavin