If I understand your question correctly, you're asking how to invoke a
block that's passed into a method written as a native extension. Is
that correct?
In a Ruby extension written in C, you would use something like this:
// if a block was passed to this method then invoke it
if(rb_block_given_p())
{
rb_yield(/* args */);
}
rb_block_given_p() returns true if a code block was passed into the
method being processed. And rb_yield invokes that block with the
provided arguments (you can pass 0 or more args to the rb_yield).
HTH.
···
On Wed, Apr 18, 2012 at 12:34 PM, Iñaki Baz Castillo <ibc@aliax.net> wrote:
Not exactly. What I need is not to execute the passed block, but to
*get* it as a VALUE object to store it somewhere in my C code and so.
···
2012/4/18 Darryl L. Pierce <mcpierce@gmail.com>:
If I understand your question correctly, you're asking how to invoke a
block that's passed into a method written as a native extension. Is
that correct?