From: Phil Tomson Date: 2006-08-15T03:49:56+09:00 Subject: Re: Get formal parameter names of a method? On 8/14/06, Jeff Cohen wrote: > Is there a way to reflect on a method to get the declard names of the > parameters? > > class Equipment > > def install(tool, packaging) > end > > end > > I can do this: > > m = Equipment.new.method(:install) > m.arity # => 2 > > I want to somehow find out that the client code has declared the > parameters named 'tool' and 'packaging'. > > Is this possible somehow? I feel like it should be, but I can't quite > figure it out. > > Thanks! > Jeff > the only way you could do this now would be to use ParseTree: http://rubyforge.org/projects/parsetree/ Maybe there will be a built-in way to do this in 2.0? Phil