Mega Code Archive

 
Categories / Ruby / Reflection
 

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