Project

General

Profile

Actions

Feature #7609

closed

Class#singleton_class?

Added by nobu (Nobuyoshi Nakada) over 11 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
[ruby-core:51087]

Description

Related to #7554, there is no way to tell the called method is a singleton method or an ordinary method.


Files

singleton_class_p.patch (1.34 KB) singleton_class_p.patch nobu (Nobuyoshi Nakada), 12/23/2012 05:48 PM

Updated by marcandre (Marc-Andre Lafortune) over 11 years ago

Moving to Feature requests.

Just curious about use case?

Also, can be hacked in Ruby already...

class Class
  def singleton_class?
    Class.new(self) && true rescue false
  end
end
Actions #2

Updated by marcandre (Marc-Andre Lafortune) over 11 years ago

  • Tracker changed from Bug to Feature

Updated by matz (Yukihiro Matsumoto) over 11 years ago

  • Assignee set to nobu (Nobuyoshi Nakada)
  • Target version set to 2.6

OK.

Actions #4

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r42449.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


object.c: Module#singleton_class?

  • object.c (rb_mod_singleton_p): new method Module#singleton_class? to
    return whether the receiver is a singleton class or not.
    [ruby-core:51087] [Feature #7609]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0