Module | Uninheritable |
In: |
lib/facets/more/uninheritable.rb
|
Allows an object to declare itself as unable to be subclassed. The technique behind this is very simple (redefinition of inherited), so this just provides an easier way to do the same thing with a consistent error message.
class A extend Uninheritable end class B < A; end # => raises TypeError
Redefines a class‘s inherited definition to prevent subclassing of the class extended by this module.