Commit 7add86f

mo khan <mo@mokhan.ca>
2013-03-24 04:29:49
remove extra logging and clean up module include in proxy"
1 parent 9ae57cc
Changed files (2)
invocation.rb
@@ -10,7 +10,6 @@ module Booty
     end
 
     def proceed
-        p "PROCEED #{@instance} #{@method} #{@arguments} #{@block}"
       if @block
         @result = @instance.public_send(@method, @arguments, @block)
       else
proxy.rb
@@ -7,22 +7,12 @@ module Booty
     end
 
     def add_interceptor(method, interceptor)
-      #self.class.define_method(method.to_sym) do |*args, &block|
-        #interceptor.intercept(create_invocation_for(method, args, block))
-      #end
-
-      mod = Module.new do
-        define_method(method.to_sym) do |*args, &block|
-          p "CALLING #{method}"
-          invocation = create_invocation_for(method, args, block)
-          interceptor.intercept(invocation)
-          invocation.result
-        end
-      end
-      self.extend(mod)
+      self.extend(create_module_for(method, interceptor))
       self
     end
 
+    private
+
     def create_invocation_for(method, args, block)
       Invocation.new(@target, method, args, block)
     end
@@ -34,5 +24,15 @@ module Booty
         @target.public_send(method, *args)
       end
     end
+
+    def create_module_for(method, interceptor)
+      Module.new do
+        define_method(method.to_sym) do |*args, &block|
+          invocation = create_invocation_for(method, args, block)
+          interceptor.intercept(invocation)
+          invocation.result
+        end
+      end
+    end
   end
 end