Project

General

Profile

Bug #2199

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

Added by marcandre (Marc-Andre Lafortune) about 10 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
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) # ==> #...
A.new.method(:is_private) # ==> NameError: undefined method is_private' for classA'

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

History

#1

Updated by marcandre (Marc-Andre Lafortune) about 10 years ago

  • Subject changed from Object#method should call respond_to_missing(sym, true) to Object#method should call respond_to_missing?(sym, true)
  • Assignee set to matz (Yukihiro Matsumoto)

=begin

=end

#2

Updated by marcandre (Marc-Andre Lafortune) about 10 years ago

  • Status changed from Open to Closed

=begin
Applied in r25325.
=end

Also available in: Atom PDF