Re: [jruby-dev] how to retrieve parameter names

2010-11-18 Thread David Calavera
There is another way to access it running the 1.8 version but I don't remember the syntax right now using this: https://github.com/jruby/jruby/blob/master/src/org/jruby/RubyJRuby.java#L621 it needs to require the jruby/

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Hirotsugu Asari
Th On Nov 15, 2010, at 3:00 PM, Guilherme Silveira wrote: > Hi there, > >> $ jruby --1.9 -S irb >> irb(main):001:0> lambda {|arg1, arg2, arg3=true, *rest|}.parameters >> => [[:req, :arg1], [:req, :arg2], [:opt, :arg3], [:rest, :rest]] > That's exactly what I needed and really easy to use. I do no

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Guilherme Silveira
Hi there, > $ jruby --1.9 -S irb > irb(main):001:0> lambda {|arg1, arg2, arg3=true, *rest|}.parameters > => [[:req, :arg1], [:req, :arg2], [:opt, :arg3], [:rest, :rest]] That's exactly what I needed and really easy to use. I do not have a problem to be only 1.9.x compatible. >From the RubyClass ob

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Hirotsugu Asari
On Nov 15, 2010, at 8:11 AM, Werner Schuster (murphee) wrote: > On 11/15/10 4:58 PM, Guilherme Silveira wrote: >> Thanks Roland, >> >> ParseTree and Ripper are file source parsers, > That's incorrect for ParseTree, which essentially just turned MRI's AST into > a Ruby data structure, ie. it wor

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Werner Schuster (murphee)
On 11/15/10 4:58 PM, Guilherme Silveira wrote: Thanks Roland, ParseTree and Ripper are file source parsers, That's incorrect for ParseTree, which essentially just turned MRI's AST into a Ruby data structure, ie. it worked at runtime without looking at the source. Merb had a feature, long ago,

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Guilherme Silveira
Thanks Roland, ParseTree and Ripper are file source parsers, not runtime reflection apis so they might not give me the correct parameter names if I can't get to the source file from a running point of my code. Thanks anyways, lets see if someone from the JRuby teams knows if its available. regar

Re: [jruby-dev] how to retrieve parameter names

2010-11-15 Thread Roland Swingler
I'm pretty sure that there is no access to the parameter names, from looking at this sort of problem a year or so ago. That was on MRI ruby, don't know if Jruby is different in this regard. You might get some mileage by looking at using ParseTree (ruby 1.8) or Ripper (1.9) to get information from

[jruby-dev] how to retrieve parameter names

2010-11-15 Thread Guilherme Silveira
Hello, When introspecting a RubyClass object I would like to access a method's parameter name list. The Arity class only gives me access to the arity number itself, not the variables names. Is it possible to access that list or is it lost while evaluating the .rb source? Regards Guilherme Silvei