Refactoring Ruby

Rich Kilmer wrote:

How about this:

class Foo
def
puts “Warning… called from #{caller}”
get_with_index(index)
end
def get_with_index(index)
#do something different
end
end

Using “caller” is a great idea. If you need additional information, you can
get a full backtrace by using:

 puts "Warning...[] called from " + caller.join(' <- ')