Module: Releasy::Mixins::Register
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/releasy/mixins/register.rb
Overview
Maintains a registry of classes within a module.
Instance Method Summary collapse
-
#register(klass) ⇒ Object
Register a class with this register of classes of that type.
Instance Method Details
#register(klass) ⇒ Object
Register a class with this register of classes of that type.
36 37 38 39 40 |
# File 'lib/releasy/mixins/register.rb', line 36 def register(klass) raise TypeError, "Can only register classes" unless klass.is_a? Class raise ArgumentError, "To register, a class must have TYPE defined" unless klass.const_defined? :TYPE registered[klass::TYPE] = klass end |