<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/family_person_spec.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/family_person.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -15,35 +15,39 @@ module Roxy
         raise &quot;Cannot proxy an existing method, \&quot;#{name}\&quot;, and also have a :to option.  Please use one or the other.&quot; if
           original_method and options[:to]  
         
-        # If we're proxying an existing method, we need to move it out
-        # of the way so we can take over
+        # If we're proxying an existing method, we need to store
+        # the original method and move it out of the way so
+        # we can take over
         if original_method        
           new_method = &quot;proxied_#{name}&quot;
           alias_method new_method, &quot;#{name}&quot;
-          options[:to] = lambda { |owner| owner.send(new_method) }
+          options[:to] = original_method
         end
         
         roxy_proxy_methods[name] = [options, block]
         
         # If we have a no-arg method we're proxying, or if we're not
         # proxying an existing method at all, we can do a basic def
+        # and memoize the proxy
         if !original_method or original_method.arity == 0
           class_eval &lt;&lt;-EOS, __FILE__, __LINE__
             def #{name}
               @#{name}_proxy ||= Proxy.new(self, self.class.roxy_proxy_methods[:#{name}][0],
+                                                 nil,
                                                  &amp;self.class.roxy_proxy_methods[:#{name}][1])
             end
           EOS
           
         # If we have a proxied method with arguments, we need to
         # retain them
-        # else
-        #           class_eval &lt;&lt;-EOS, __FILE__, __LINE__
-        #             def #{name}(*args)
-        #               @#{name}_proxy ||= Proxy.new(self, self.class.roxy_proxy_methods[:#{name}][0],
-        #                                                  &amp;self.class.roxy_proxy_methods[:#{name}][1])
-        #             end
-        #           EOS
+        else
+          class_eval &lt;&lt;-EOS, __FILE__, __LINE__
+            def #{name}(*args)
+              Proxy.new(self, self.class.roxy_proxy_methods[:#{name}][0],
+                              args,
+                              &amp;self.class.roxy_proxy_methods[:#{name}][1])
+            end
+          EOS
                               
         end        
       end</diff>
      <filename>lib/roxy/moxie.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,9 +12,10 @@ module Roxy
     # http://onestepback.org/index.cgi/Tech/Ruby/BlankSlate.rdoc
     instance_methods.each { |m| undef_method m unless m =~ /(^__|^proxy_)/ }
     
-    def initialize(owner, options, &amp;block)
+    def initialize(owner, options, args, &amp;block)
       @owner = owner
-      @target = options[:to]      
+      @target = options[:to]
+      @args = args
       
       # Adorn with user-provided proxy methods
       [options[:extend]].flatten.each { |ext| proxy_extend(ext) } if options[:extend]
@@ -23,7 +24,15 @@ module Roxy
       
     def proxy_owner; @owner; end
     def proxy_target
-      @proxy_target_object ||= @target.is_a?(Proc) ? @target.call(@owner) : @target
+      @proxy_target_object ||=
+        if @target.is_a?(Proc)
+          @target.call(@owner)
+        elsif @target.is_a?(UnboundMethod)
+          bound_method = @target.bind(proxy_owner)
+          bound_method.arity == 0 ? bound_method.call : bound_method.call(*@args)
+        else
+          @target
+        end
     end
   
     # Delegate all method calls we don't know about to target object</diff>
      <filename>lib/roxy/proxy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,19 +9,19 @@ describe &quot;Proxy&quot; do
   end
 
   it &quot;should properly evaluate a block-based target&quot; do
-    proxy = Roxy::Proxy.new(@owner, :to =&gt; @lambda_target)
+    proxy = Roxy::Proxy.new(@owner, {:to =&gt; @lambda_target}, nil)
     proxy.should == @target
   end
   
   it &quot;should properly adorn the proxy with proxy methods&quot; do
-    proxy = Roxy::Proxy.new(@owner, :to =&gt; @target) do
+    proxy = Roxy::Proxy.new(@owner, {:to =&gt; @target}, nil) do
       def poop; 'poop'; end
     end
     proxy.poop.should == 'poop'
   end
   
   it &quot;should make the proxy owner accessible to the target block&quot; do
-    proxy = Roxy::Proxy.new(@owner, :to =&gt; proc { |owner| owner })
+    proxy = Roxy::Proxy.new(@owner, {:to =&gt; proc { |owner| owner }}, nil)
     proxy.should == @owner
   end
     </diff>
      <filename>spec/proxy_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -48,7 +48,10 @@ describe &quot;Roxy&quot; do
     @person.ancestors(true, false).women.should == ['m_ancestor2']
     @person.ancestors(false, true).men.should == ['p_ancestor1']
     @person.ancestors(false, true).women.should == ['p_ancestor2']
-    @person.ancestors(true, true).men.should == ['p_ancestor1', 'm_ancestor1']
-    @person.ancestors.women.should == ['p_ancestor2', 'm_ancestor2']
+    @person.ancestors(true, true).men.sort.should == ['p_ancestor1', 'm_ancestor1'].sort
+  end
+  
+  it &quot;should retain default argument values when calling a proxied method with arguments&quot; do
+    @person.ancestors.women.sort.should == ['p_ancestor2', 'm_ancestor2'].sort
   end
 end
\ No newline at end of file</diff>
      <filename>spec/roxy_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>spec/family_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/fixtures/family.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>583e0a6fba3ffe83975a7ab02bf36bc9a3b861af</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Daigle</name>
    <email>ryan.daigle@gmail.com</email>
  </author>
  <url>http://github.com/yfactorial/roxy/commit/0acd2df2b41f8f657a9323845aaeda1d7fea0673</url>
  <id>0acd2df2b41f8f657a9323845aaeda1d7fea0673</id>
  <committed-date>2008-11-14T06:20:24-08:00</committed-date>
  <authored-date>2008-11-14T06:20:24-08:00</authored-date>
  <message>Added ability to proxy methods with arguments</message>
  <tree>b6d62e64e8747c1f7be6616295464698ad869068</tree>
  <committer>
    <name>Ryan Daigle</name>
    <email>ryan.daigle@gmail.com</email>
  </committer>
</commit>
