Module: AsyncRack::AsyncCallback::InheritanceHook
- Defined in:
- lib/async_rack/async_callback.rb
Overview
Aliases a subclass on subclassing, but only once. If that name already is in use, it will be replaced.
Instance Method Summary collapse
Instance Method Details
#alias_subclass(name, namespace = Object) ⇒ Object
61 62 63 |
# File 'lib/async_rack/async_callback.rb', line 61 def alias_subclass(name, namespace = Object) @alias_subclass = [name, namespace] end |
#inherited(klass) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/async_rack/async_callback.rb', line 67 def inherited(klass) super if @alias_subclass name, namespace = @alias_subclass @alias_subclass = nil namespace.send :remove_const, name if namespace.const_defined? name namespace.const_set name, klass klass.send :include, AsyncRack::AsyncCallback::Mixin end end |