From: Christoph Neubauer Date: 2004-07-19T22:17:12+09:00 Subject: (Simple) Tracing with Ruby Hi Rubyists ! I'm using ruby 1.6.8 (2002-12-24) [i586-mswin32] What I tinkered for tracing is (simplified) this: #begin definition def traceEntry (*args) puts "\n" puts ("ENTRY " + caller[0]) args.each {|arg| puts ("ARG: " + arg.to_s)} end def traceExit puts ("EXIT " + caller[0]) puts "\n" end #end definition #begin usage def method1 (arg1 = 0, arg2 = false, arg3 = 'hello') traceEntry (arg1, arg2, arg3) # do some stuff traceExit end method1 method1 (1, true, 'world') #end usage It produces this: #begin output ENTRY SimpleTracingWithRuby.rb:18:in `method1' ARG: 0 ARG: false ARG: hello EXIT SimpleTracingWithRuby.rb:20:in `method1' ENTRY SimpleTracingWithRuby.rb:18:in `method1' ARG: 1 ARG: true ARG: world EXIT SimpleTracingWithRuby.rb:20:in `method1' #end output My question is: How do I know the names of the formal arguments of the actual caller of TraceEntry ? Or by Example: #begin desired usage def method1 (arg1 = 1, arg2 = true, arg3 = 'hello') traceEntry # do some stuff traceExit end #end desired usage #begin desired output ENTRY SimpleTracingWithRuby.rb:18:in `method1' arg1: 0 arg2: false arg3: hello EXIT SimpleTracingWithRuby.rb:20:in `method1' ENTRY SimpleTracingWithRuby.rb:18:in `method1' arg1: 1 arg2: true arg3: world EXIT SimpleTracingWithRuby.rb:20:in `method1' #end desired output Any ideas welcomed ! Chris