Module: Configurability::DeferredConfig
- Defined in:
- lib/configurability/deferred_config.rb
Overview
Mixin that can be applied to classes to cause them to configure themselves as soon as they are able to.
Class Method Summary collapse
-
.extended(mod) ⇒ Object
Extension hook: log when the mixin is used.
Instance Method Summary collapse
-
#singleton_method_added(sym) ⇒ Object
Singleton method definition hook: configure the instance as soon as it overrides the #configure method supplied by the Configurability mixin itself.
Class Method Details
.extended(mod) ⇒ Object
Extension hook: log when the mixin is used.
11 12 13 14 |
# File 'lib/configurability/deferred_config.rb', line 11 def self::extended( mod ) Configurability.log.debug "Adding deferred configuration hook to %p" % [ mod ] super end |
Instance Method Details
#singleton_method_added(sym) ⇒ Object
Singleton method definition hook: configure the instance as soon as it overrides the #configure method supplied by the Configurability mixin itself.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/configurability/deferred_config.rb', line 19 def singleton_method_added( sym ) super if sym == :configure Configurability.log.debug "Re-configuring %p via deferred config hook." % [ self ] config = Configurability.loaded_config Configurability.log.debug "Propagating config to %p" % [ self ] Configurability.install_config( config, self ) end end |