Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/metaruby/backward/singleton_class_p.rb
Instance Method Summary collapse
-
#singleton_class? ⇒ Boolean
It so happens that this method to determine whether a class is a singleton class is valid for ruby 2.0 and breaks on 2.1 …
Instance Method Details
#singleton_class? ⇒ Boolean
It so happens that this method to determine whether a class is a singleton class is valid for ruby 2.0 and breaks on 2.1 … However (!) on 2.1 singleton_class? is defined
6 7 8 9 10 11 12 |
# File 'lib/metaruby/backward/singleton_class_p.rb', line 6 def singleton_class? if instance_variable_defined?(:@__singleton_class) @__singleton_class else @__singleton_class = (ancestors.first != self) end end |