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

<https://github.com/jruby/jruby/blob/master/src/org/jruby/RubyJRuby.java#L621>it
needs to require the jruby/ext library:

require 'jruby/ext'

I don't know where the "args" method is added.

On Tue, Nov 16, 2010 at 12:11 AM, Hirotsugu Asari <[email protected]>wrote:

> 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 not have a
> problem to be only 1.9.x compatible.
> From the RubyClass object, how do I get to this "parameters" method? I
> did not see it in the API and that is surely my fault.
>
>
> The method is defined in org.jruby.RubyProc.parameters(ThreadContext).
> There is no JavaDoc, since it is bound to a Ruby process.
>
>
> https://github.com/jruby/jruby/blob/master/src/org/jruby/RubyProc.java#LL360-424
>
>
> Werner, thanks for correcting it and as you mentioned, Asari's
> implementation seem to fit perfectly. For us who are trying to mix
> dependency injection within Ruby code that's the simplest and most CoC
> way to do it.
>
> Regards
>
> Guilherme Silveira
> Caelum | Ensino e Inovação
> http://www.caelum.com.br/
>
>
>

Reply via email to