[ruby-core:64008] [ruby-trunk - Bug #10092] [Open] singleton_method behaves inconsistent with singleton_methods on modules, extending self

From: am@...
Date: 2014-07-25 10:55:46 UTC
List: ruby-core #64008
Issue #10092 has been reported by Alexei Matyushkin.

----------------------------------------
Bug #10092: singleton_method behaves inconsistent with singleton_methods on=
 modules, extending self=20
https://bugs.ruby-lang.org/issues/10092

* Author: Alexei Matyushkin
* Status: Open
* Priority: Normal
* Assignee:=20
* 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=E2=80=99s consider the following code:

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

it prints:

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

The method is listed under `singleton_methods` while the call to it via `si=
ngleton_method` raises an error.



--=20
https://bugs.ruby-lang.org/

In This Thread

Prev Next