Method: BBLib::SimpleInit::ClassMethods#build_descendant
- Defined in:
- lib/bblib/core/mixins/simple_init.rb
#build_descendant(name, namespace: parent_namespace) ⇒ Object
Dynamically create a new class based on this one. By default this class is generated in the same namespace as the parent class. A custom namespace can be passed in using the named argument :namespace.
159 160 161 |
# File 'lib/bblib/core/mixins/simple_init.rb', line 159 def build_descendant(name, namespace: parent_namespace) namespace.const_set(name, Class.new(self)) end |