E
elathan
Hello!
Suppose I have some ruby code:
def bar
puts "Hello"
end
foo { bar }
Now, foo is part of a Ruby extension, but bar is user implemented.
The C implementation of foo can use rb_block_given_p() to identify if
it was called with a block. My question is: can I grab the bar method, save
its pointer somewhere and call it from other places in my code? I.e. is
there an option in the Ruby C API to parse/identify args in a given block?
I don't want to yield bar, just save it and call it later (foo is actually a C++
constructor, which takes as an argument a pointer to a user function).
Regards,
Suppose I have some ruby code:
def bar
puts "Hello"
end
foo { bar }
Now, foo is part of a Ruby extension, but bar is user implemented.
The C implementation of foo can use rb_block_given_p() to identify if
it was called with a block. My question is: can I grab the bar method, save
its pointer somewhere and call it from other places in my code? I.e. is
there an option in the Ruby C API to parse/identify args in a given block?
I don't want to yield bar, just save it and call it later (foo is actually a C++
constructor, which takes as an argument a pointer to a user function).
Regards,