diff options
Diffstat (limited to 'spec/rubyspec/optional/capi/ext/proc_spec.c')
-rw-r--r-- | spec/rubyspec/optional/capi/ext/proc_spec.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/rubyspec/optional/capi/ext/proc_spec.c b/spec/rubyspec/optional/capi/ext/proc_spec.c index b7a47536d9..f9c0f6b1b9 100644 --- a/spec/rubyspec/optional/capi/ext/proc_spec.c +++ b/spec/rubyspec/optional/capi/ext/proc_spec.c @@ -17,6 +17,18 @@ VALUE proc_spec_rb_proc_new(VALUE self) { } #endif +#ifdef HAVE_RB_PROC_ARITY +VALUE proc_spec_rb_proc_arity(VALUE self, VALUE prc) { + return INT2FIX(rb_proc_arity(prc)); +} +#endif + +#ifdef HAVE_RB_PROC_CALL +VALUE proc_spec_rb_proc_call(VALUE self, VALUE prc, VALUE args) { + return rb_proc_call(prc, args); +} +#endif + /* This helper is not strictly necessary but reflects the code in wxRuby that * originally exposed issues with this Proc.new behavior. */ @@ -57,6 +69,14 @@ void Init_proc_spec(void) { rb_define_method(cls, "rb_proc_new", proc_spec_rb_proc_new, 0); #endif +#ifdef HAVE_RB_PROC_ARITY + rb_define_method(cls, "rb_proc_arity", proc_spec_rb_proc_arity, 1); +#endif + +#ifdef HAVE_RB_PROC_CALL + rb_define_method(cls, "rb_proc_call", proc_spec_rb_proc_call, 2); +#endif + rb_define_method(cls, "rb_Proc_new", proc_spec_rb_Proc_new, 1); } |