lib/spank/interceptor_registration.rb in spank-0.0.2 vs lib/spank/interceptor_registration.rb in spank-0.0.1369197478

- old
+ new

@@ -1,17 +1,25 @@ module Spank class InterceptorRegistration def initialize(method_symbol) @method = method_symbol + @interceptors = [] end def with(interceptor) - @interceptor = interceptor + @interceptors.push(interceptor) + self end + def and(interceptor) + with(interceptor) + end + def intercept(instance) - proxy= Proxy.new(instance) - proxy.add_interceptor(@method, @interceptor) + proxy = Proxy.new(instance) + @interceptors.each do |interceptor| + proxy.add_interceptor(@method, interceptor) + end proxy end end end