Project

General

Profile

Actions

Bug #2199

closed

Object#method should call respond_to_missing?(sym, true)

Added by marcandre (Marc-Andre Lafortune) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-10-13 trunk 25317) [x86_64-darwin10.0.0]
Backport:

Description

=begin
Is there any reason I'm missing?

class A
def respond_to_missing?(method, private = false)
method == :is_private && private
end

 def is_private2
 end
 private :is_private2

end

A.new.method(:is_private2) # ==> #<Method: A#is_private2>...
A.new.method(:is_private) # ==> NameError: undefined method is_private' for class A'

If not:

diff --git a/proc.c b/proc.c
index 5ed3c01..b7c632c 100644
--- a/proc.c
+++ b/proc.c
@@ -902,7 +902,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
VALUE sym = ID2SYM(id);

     if (obj != Qundef && !rb_method_basic_definition_p(klass, rmiss)) {
  •       if (RTEST(rb_funcall(obj, rmiss, 1, sym))) {
    
  •       if (RTEST(rb_funcall(obj, rmiss, 2, sym, Qtrue))) {
              def = ALLOC(rb_method_definition_t);
              def->type = VM_METHOD_TYPE_MISSING;
              def->original_id = id;
    

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0