Skip to content

Commit

Permalink
* vm_method.c (basic_obj_respond_to): call #respond_to_missing?
Browse files Browse the repository at this point in the history
  always with two arguments.  [ruby-core:26090]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Oct 17, 2009
1 parent c02e47c commit eccb700
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/delegate.rb
Expand Up @@ -148,7 +148,7 @@ def method_missing(m, *args, &block)
# 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}"
Expand Down
8 changes: 4 additions & 4 deletions vm_method.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -1214,15 +1214,15 @@ 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.
*
* 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;
}
Expand All @@ -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);
Expand Down

0 comments on commit eccb700

Please sign in to comment.