From: "myronmarston (Myron Marston)" <myron.marston@...>
Date: 2012-08-04T15:39:55+09:00
Subject: [ruby-core:46978] [ruby-trunk - Bug #6832][Open] Module#instance_method and Module#method_defined? act inconsistently w.r.t #respond_to_missing?


Issue #6832 has been reported by myronmarston (Myron Marston).

----------------------------------------
Bug #6832: Module#instance_method and Module#method_defined? act inconsistently w.r.t #respond_to_missing?
https://bugs.ruby-lang.org/issues/6832

Author: myronmarston (Myron Marston)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: 1.9.3p194


It's awesome that #respond_to_missing? allows Object#method to work for messages handled by #method_missing.  However, I was surprised to discover that Module#instance_method and Module#method_defined? don't similarly take #respond_to_missing? into account.  It seems very inconsistent.

Here's the behavior I'm seeing:

https://gist.github.com/3255162

In this example, I would expect Foo#method_defined?(:foo_bar) to return true, and I would expect Foo#instance_method(:foo_bar) to return an UnboundMethod that, when bound to a Foo instance, would use #method_missing to perform the method.


-- 
http://bugs.ruby-lang.org/