From: "Brian F. Feldman" Date: 2001-09-25T05:56:50+09:00 Subject: [ruby-talk:21648] Re: C++ / Ruby questions again jglueck@vol.at (=?ISO-8859-1?Q?Bernhard_Gl=FCck?=) wrote: > ts wrote in message news:<200109241311.f8ODBI620272@moulon.inra.fr>... > > >>>>> "B" == =?ISO-8859-1?Q?Bernhard Gl=FCck?= writes: > > > > B> What the h*** is "#arity" ? Is this a ruby method ? or something else > > > > Yes. > > > > Proc#arity means the instance method arity > > Proc::new means the class method new > > > > For example, in ruby > > > > pigeon% cat b.rb > > #!/usr/bin/ruby > > class A > > def a(b, c) > > end > > end > > > > a = A.new > > am = a.method(:a) > > p am.arity > > pigeon% > > > > pigeon% b.rb > > 2 > > pigeon% > > > > See > > > > http://www.rubycentral.com/book/ref_c_method.html#arity > > > > > > Guy Decoux > > > Hm that's a nice thing for ruby. but unfortunatly it does not help > me... I need to call a ruby instance method from C++ ... so i need to > know in C++ how many parameters the ruby instance method i want to > call takes.... > So the ruby method for doing this does not help me.. > Is there a way of doing the same using the C API ? Do you want something more than to call #arity on something from C? Do you need to know it at run-time or compile time? If at run-time, you can just call the arity method. -- Brian Fundakowski Feldman \ FreeBSD: The Power to Serve! / green@FreeBSD.org `------------------------------'