Sha256: a560d3f2cc416ebccfcea0b0e6e5f12b985e41e89bfd95e4f46923869aaaca23

Contents?: true

Size: 816 Bytes

Versions: 2

Compression:

Stored size: 816 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
			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

2 entries across 2 versions & 1 rubygems

Version Path
configurability-1.0.8 lib/configurability/deferredconfig.rb
configurability-1.0.7 lib/configurability/deferredconfig.rb