A possibly related question:

I want to implement list for a custom object...for guidance I am looking at
RubyArray's implementation. The method signature for each is:
     public IRubyObject each(ThreadContext context, Block block) {
         return block.isGiven() ? eachCommon(context, block) :
enumeratorize(context.getRuntime(), this, "each");
     }

What controls which methods receive a ThreadContext and which do not? I look
in the method declarations and some do, some do not. If I have a method that
needs the runtime, is there a way that I can get it?

Thanks for your help, I promise I'll try and pay it forward :)
Jon

2011/10/18 Jonathan Coveney <jcove...@gmail.com>

> Charlie,
>
> Thanks for your guidance.
>
> It makes sense that you need to have this binding, but I'm not sure about
> how to implement Library. What action causes load to be invoked? A require
> statement?
>
> Thanks
>
>
> 2011/10/18 Charles Oliver Nutter <head...@headius.com>
>
>> Hmm, not really any good docs. Along with annotating, you need to
>> define the extension classes and tell them to bind annotated methods.
>> A good example extension would be jruby-spymemcached:
>>
>> https://github.com/headius/jruby-spymemcached
>>
>> Key details are clsOrMod.defineAnnotatedMethods(Something.class) and
>> not shown in this extension is the constant version
>> clsOrMod.defineAnnotatedConstants(Something.class).
>>
>> - Charlie
>>
>> On Tue, Oct 18, 2011 at 11:34 PM, Jonathan Coveney <jcove...@gmail.com>
>> wrote:
>> > Adding to this, I tried including @JRubyMethod tags and whatnot as per
>> the
>> > instructions, and I compiled my project and it didn't seem like they got
>> > picked up...is there something special I need to do?
>> >
>> > Thanks again. I am really intrigued by this project.
>> >
>> > 2011/10/18 Jonathan Coveney <jcove...@gmail.com>
>> >>
>> >> Is there any documentation on using @JRubyMethod, @JRubyClass, that
>> sort
>> >> of thing, and the arguments that they accept? I can sort of figure it
>> out
>> >> from the source but it is all uncommented and I can't find anything in
>> the
>> >> wiki. In the same vein, any tips on extending RubyObject would be
>> lovely.
>> >>
>> >> Thanks!
>> >> Jon
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>

Reply via email to