Sha256: e5964c1d6fb49f8622baa2daffba275560a75e66c9ccae74bcec047d4224f63a
Contents?: true
Size: 600 Bytes
Versions: 17
Compression:
Stored size: 600 Bytes
Contents
module Spank class Component include LambdaBehaviours def initialize(class_key, &block) @factory_method = block @interceptors = [] end def create(container) instance = @factory_method.call(container) @interceptors.each do |interceptor| instance = interceptor.intercept(instance) end instance end def as_singleton @factory_method = memoize(@factory_method) end def intercept(method) interceptor = InterceptorRegistration.new(method) @interceptors.push(interceptor) interceptor end end end
Version data entries
17 entries across 17 versions & 1 rubygems