From: "Jörg W Mittag" Date: 2009-06-17T17:50:06+09:00 Subject: Re: Ruby Reflection Method Parameters Phrogz wrote: > On Jun 16, 5:13�pm, Sirisha Pusapati > wrote: >> I have a class called ClassFromString and it has a method called >> getCounterValue. It takes a parameter called name. Is there in Ruby >> using reflection to get the name of the parameters of a method. > There is not. That depends on what your definition of "is" is. You are wrong, in so far as Proc#parameters does exist in Ruby 1.9.2. You are right, in so far as Ruby 1.9.2 doesn't exist (yet). See: > The closest you can get is a hack that reads in source > files (if you know where they are, and they're pure Ruby ... and they exist at all (i.e. the method was not created using eval or define_method) > ) and either > parses the raw code or looks at the abstract syntax tree. Here is how the Merb-Action-Args Plugin for Merb does it: JRuby: (using JRuby's own runtime reflection) MRI: (using ParseTree) For all others, it tries to use the MethoPara Gem, which, however, only works on YARV 1.9.1 (and *not* on Ruby 1.9.1, as the README incorrectly claims!): jwm