Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Module#singleton_class?
() -> bool
mod.singleton_class? → true or false
object.c
View on GitHub ↗
static VALUE
rb_mod_singleton_p(VALUE klass)
{
return RBOOL(RCLASS_SINGLETON_P(klass));
}
Returns true if mod is a singleton class or false if it is an ordinary class or module.
Example
class C end C.singleton_class? #=> false C.singleton_class.singleton_class? #=> true
See also
#set_temporary_name
#to_s
#ruby2_keywords
#undefined_instance_methods
also in
4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0