From: nobu@... Date: 2014-07-25T12:17:15+00:00 Subject: [ruby-core:64009] [ruby-trunk - Bug #10092] [Rejected] singleton_method behaves inconsistent with singleton_methods on modules, extending self Issue #10092 has been updated by Nobuyoshi Nakada. Description updated Status changed from Open to Rejected You should compare `singleton_methods(false)`. ---------------------------------------- Bug #10092: singleton_method behaves inconsistent with singleton_methods on modules, extending self https://bugs.ruby-lang.org/issues/10092#change-48024 * Author: Alexei Matyushkin * Status: Rejected * Priority: Normal * Assignee: * Category: core * Target version: current: 2.2.0 * ruby -v: ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] * Backport: 2.1: UNKNOWN ---------------------------------------- Let���s consider the following code: ~~~ruby 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: ~~~ruby # 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. -- https://bugs.ruby-lang.org/