From: Matthias Reitinger Date: 2008-07-06T02:28:47+09:00 Subject: Re: Parameter name reflection Oliver Saunders wrote: > If I declare > > def foo(a, b) > end > > What code should I use to find the names of the parameters? You could use ParseTree[1] for that purpose: require 'rubygems' require 'parse_tree' def foo(a, b) end sexp = ParseTree.translate(self.class, :foo) args = sexp.assoc(:scope).assoc(:block).assoc(:args)[1..-1] puts args[0] # => a puts args[1] # => b HTH, Matthias. [1]: http://parsetree.rubyforge.org/ParseTree/ -- Posted via http://www.ruby-forum.com/.