Sha256: 6a1cbbfd6d73f7f1dbc2c2fe7cd98f8c51aba90ce909419ec9ea7e29a85683d5
Contents?: true
Size: 902 Bytes
Versions: 17
Compression:
Stored size: 902 Bytes
Contents
#!/usr/bin/env ruby -wKU require 'configurability' # Mixin that can be applied to classes to cause them to configure themselves # as soon as they are able to. module Configurability::DeferredConfig ### Extension hook: log when the mixin is used. def self::extended( mod ) Configurability.log.debug "Adding deferred configuration hook to %p" % [ mod ] super end ### Singleton method definition hook: configure the instance as soon as it ### overrides the #configure method supplied by the Configurability mixin itself. 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 end # module Configurability::DeferredConfig
Version data entries
17 entries across 17 versions & 1 rubygems