Executing the Block
rb_yield(Qnil);
Replace Qnil with the parameters you wish to pass to the block. The Result of the block is returned.
rb_block_given_p();
This function will tell you if a block was passed. Blocks are not counted as parameters so if your function only accepts a block then you need to specify 0 as the number of parameters.
No comments:
Post a Comment