1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_method.c (basic_obj_respond_to): call #respond_to_missing?

always with two arguments.  [ruby-core:26090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2009-10-17 05:34:51 +00:00
parent c02e47c4e0
commit eccb700286
3 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Sat Oct 17 11:27:44 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* vm_method.c (basic_obj_respond_to): call #respond_to_missing?
always with two arguments. [ruby-core:26090]
Sat Oct 17 08:51:44 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/delegate.rb (Delegator#respond_to_missing): warn only when

View file

@ -148,7 +148,7 @@ class Delegator
# Checks for a method provided by this the delegate object by forwarding the
# call through \_\_getobj\_\_.
#
def respond_to_missing?(m, include_private = false)
def respond_to_missing?(m, include_private)
r = self.__getobj__.respond_to?(m, include_private)
if r && include_private && !self.__getobj__.respond_to?(m, false)
warn "#{caller(3)[0]}: delegator does not forward private method \##{m}"

View file

@ -1157,7 +1157,7 @@ basic_obj_respond_to(VALUE obj, ID id, int pub)
case 2:
return FALSE;
case 0:
return RTEST(rb_funcall(obj, respond_to_missing, pub ? 1 : 2, ID2SYM(id), Qtrue));
return RTEST(rb_funcall(obj, respond_to_missing, 2, ID2SYM(id), pub ? Qfalse : Qtrue));
default:
return TRUE;
}
@ -1214,7 +1214,7 @@ obj_respond_to(int argc, VALUE *argv, VALUE obj)
/*
* call-seq:
* obj.respond_to_missing?(symbol, include_private=false) => true or false
* obj.respond_to_missing?(symbol, include_private) => true or false
*
* Hook method to return whether the _obj_ can respond to _id_ method
* or not.
@ -1222,7 +1222,7 @@ obj_respond_to(int argc, VALUE *argv, VALUE obj)
* See #respond_to?.
*/
static VALUE
obj_respond_to_missing(int argc, VALUE *argv, VALUE obj)
obj_respond_to_missing(VALUE obj, VALUE priv)
{
return Qfalse;
}
@ -1234,7 +1234,7 @@ Init_eval_method(void)
#define rb_intern(str) rb_intern_const(str)
rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
rb_define_method(rb_mKernel, "respond_to_missing?", obj_respond_to_missing, -1);
rb_define_method(rb_mKernel, "respond_to_missing?", obj_respond_to_missing, 2);
rb_define_private_method(rb_cModule, "remove_method", rb_mod_remove_method, -1);
rb_define_private_method(rb_cModule, "undef_method", rb_mod_undef_method, -1);