How does one handle Ruby 2.0.0 keyword arguments from a C extension?
Background
def example(name: 'Bob' hat_color: 'red')
puts "#{name} has a #{hat_color} hat!"
end
example #=> "Bob has a red hat!"
example(name: 'Joe', hat_color: 'blue') #=> "Joe has a blue hat!"
Keyword arguments (like the above) are quite useful when handling methods that have a lot of different call sequences or options. I have one such method in a C extension (a blit
method that handles most of the OpenGL drawing in my project) and I am wondering how I might have the method handle keyword arguments from ruby.
Ideas
Based on some research I have done, I think that such handling might be done through the :
option on the rb_scan_args
C function. However, I have been unable to find any information on how to use it to do so.
:
option torb_scan_args
do? – Omni