Project

General

Profile

Actions

Bug #6832

closed

Module#instance_method and Module#method_defined? act inconsistently w.r.t #respond_to_missing?

Added by myronmarston (Myron Marston) over 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
ruby -v:
1.9.3p194
Backport:
[ruby-core:46978]

Description

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0