diff options
author | Gonzalo Garramuno <ggarra@advancedsl.com.ar> | 2007-07-24 05:46:55 +0000 |
---|---|---|
committer | Gonzalo Garramuno <ggarra@advancedsl.com.ar> | 2007-07-24 05:46:55 +0000 |
commit | bbd80cfa847cea59ae8c78039ab65c58e222d7e8 (patch) | |
tree | 50826cd2d3eda6073ebeb72201ab19c65d03651f /Lib/ruby/rubystdfunctors.swg | |
parent | 2b93511d176da9a659f251918eb0f0d46f45dc44 (diff) | |
download | swig-bbd80cfa847cea59ae8c78039ab65c58e222d7e8.tar.gz |
Moved some of the common checks for methods/procs and arity
to rubyrun.swg, as they are useful even for not stl stuff.
Added a fragment trait for marking STL containers, but this
fragment cannot be attached due to SWIG %template limitations.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9874 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/ruby/rubystdfunctors.swg')
-rw-r--r-- | Lib/ruby/rubystdfunctors.swg | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/Lib/ruby/rubystdfunctors.swg b/Lib/ruby/rubystdfunctors.swg index be23ffe84..82093823d 100644 --- a/Lib/ruby/rubystdfunctors.swg +++ b/Lib/ruby/rubystdfunctors.swg @@ -26,40 +26,6 @@ %include rubyclasses.swg -%{ -/* This function can be used to check whether a proc or method or similarly - callable function has been passed. Usually used in a %typecheck. */ -SWIGINTERN -int SWIG_Ruby_isCallable( VALUE proc ) -{ - static VALUE call_id = rb_intern("call"); - if ( rb_respond_to( proc, call_id ) ) - return 1; - return 0; -} - -/* This function can be used to check the arity (number of arguments) - a proc or method can take. Usually used in a %typecheck. - Valid arities will be that equal to minimal or those < 0 - which indicate a variable number of parameters at the end. - */ -SWIGINTERN -int SWIG_Ruby_arity( VALUE proc, int minimal ) -{ - static VALUE arity_id = rb_intern("arity"); - if ( rb_respond_to( proc, arity_id ) ) - { - VALUE num = rb_funcall( proc, arity_id, 0 ); - int arity = NUM2INT(num); - if ( arity < 0 && (arity+1) < -minimal ) return 1; - if ( arity == minimal ) return 1; - return 1; - } - return 0; -} - -%} - namespace swig { |