From: David Ishmael Date: 2006-03-23T06:53:53+09:00 Subject: Re: Introspection of method parameters Try this ... class Test def initialize end def one( a ) end def two( a, b ) end end t = Test.new m1 = t.method( :one ) m2 = t.method( :two ) puts "Method one has " + m1.arity.to_s + " parameters" puts "Method one has " + m2.arity.to_s + " parameters" => Method one has 1 parameters => Method two has 2 parameters -Dave -----Original Message----- From: Keith Sader [mailto:ksader@gmail.com] Sent: Wednesday, March 22, 2006 4:32 PM To: ruby-talk ML Subject: Re: Introspection of method parameters Ok, I tried that and it gets me to where I am now, I can see the methods for an object, but I can't tell if the method a.) takes a parameter b.) if it takes a parameter the # of parameters it takes. On 3/22/06, David Ishmael wrote: > Try this ... > > http://www.rubycentral.com/book/ospace.html > > -Dave > > > I'm trying to find out the number and name of a method's parameters. > I've googled for 'ruby method parameter introspection' and come up > with almost nothing. Is there a way to ask a method for the > parameters it takes? > > Could this way also show me the method overloads? > foo() > foo(param1) > foo(param1, param2) > etc. > thanks, -- Keith Sader ksader@gmail.com http://www.saderfamily.org/roller/page/ksader