Generating and Understanding Tracebacks : caller « Reflection « Ruby
- Ruby
- Reflection
- caller
Generating and Understanding Tracebacks
/usr/bin/ruby
def do_work
first = true
caller.each do |c|
puts %{#{(first ? 'I' : ' which')} was called by "#{c}"}
first = false
end
end
do_work
Related examples in the same category