From: "Darryl L. Pierce" Date: 2011-12-02T22:58:20+09:00 Subject: Re: Native extension: arguments as a hash On 12/02/2011 08:30 AM, Nikolai Weibull wrote: > On Fri, Dec 2, 2011 at 14:14, Darryl L. Pierce wrote: >> I'm working on a native extension in C for Ruby 1.8.7. The method I'm >> working on must have the signature: >> >> def receive(receiver, opts = {}) >> >> so that users can call: >> >> receiver(receiver, :timeout => 15) # :timeout is optional >> >> But I can't find a decent example of what such a method would look like >> in C. > > We have a function for this in Ruby-GNOME2: > > https://github.com/ruby-gnome2/ruby-gnome2/blob/master/glib2/ext/glib2/rbglib.c#L838 > > You can see it in use here: > > https://github.com/ruby-gnome2/ruby-gnome2/blob/0c2ea5ec150c936e00d079ca62501131e32def95/vte/ext/vte/rbvte-terminal.c#L111 Thank you! I'm looking it over now. :) -- Darryl L. Pierce http://mcpierce.multiply.com/ "What do you care what people think, Mr. Feynman?"