Bug #2199
Object#method should call respond_to_missing?(sym, true)
| Status: | Closed | Start date: | 10/13/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | core | |||
| Target version: | 1.9.2 | |||
| ruby -v: | ruby 1.9.2dev (2009-10-13 trunk 25317) [x86_64-darwin10.0.0] |
Description
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;
History
Updated by marcandre (Marc-Andre Lafortune) over 2 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)
Updated by marcandre (Marc-Andre Lafortune) over 2 years ago
- Status changed from Open to Closed
Applied in r25325.