Project

General

Profile

Actions

Bug #10092

closed

singleton_method behaves inconsistent with singleton_methods on modules, extending self

Bug #10092: singleton_method behaves inconsistent with singleton_methods on modules, extending self

Added by mudasobwa (Alexei Matyushkin) over 11 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Backport:
[ruby-core:64008]

Description

Let’s consider the following code:

module M extend self def m_i puts "m_i" end def m puts "include? = [#{singleton_methods.include?(:m_i)}]" puts "call = [#{singleton_method(:m_i).call}]" rescue puts $! end end 

it prints:

# include? = [true] # undefined singleton method `m_i' for `M' 

The method is listed under singleton_methods while the call to it via singleton_method raises an error.

Updated by nobu (Nobuyoshi Nakada) over 11 years ago Actions #1 [ruby-core:64009]

  • Description updated (diff)
  • Status changed from Open to Rejected

You should compare singleton_methods(false).

Actions

Also available in: PDF Atom