<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1,2 @@
+*.tmproj
 doc</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -8,19 +8,48 @@ module Roxy
     module ClassMethods
       
       # Set up this class to proxy on the given name
-      def proxy(name, options = {}, &amp;block)  
+      def proxy(name, options = {}, &amp;block)
         
-        # If we don't have the :to option then we are proxying an existing
-        # method
-        if(!options[:to])
-          alias_method &quot;proxied_#{name}&quot;, &quot;#{name}&quot;
-          options[:to] = lambda { |owner| owner.send(&quot;proxied_#{name}&quot;) }
-        end
+        # Make sure args are OK
+        original_method = method_defined?(name) ? instance_method(name) : nil
+        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]  
         
-        define_method(name) do
-          instance_variable_get(&quot;@#{name}_proxy&quot;) ||
-            instance_variable_set(&quot;@#{name}_proxy&quot;, Proxy.new(self, options, &amp;block))
+        # If we're proxying an existing method, we need to 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) }
         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
+        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],
+                                                 &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
+                              
+        end        
+      end
+            
+      def roxy_proxy_methods
+        @roxy_proxy_methods ||= {}
       end
     end
   end</diff>
      <filename>lib/roxy/moxie.rb</filename>
    </modified>
    <modified>
      <diff>@@ -27,4 +27,20 @@ class Person
   end
   
   proxy :neighbors, :to =&gt; ['neighbor1', 'neighbor2'], :extend =&gt; [NeighborGeographics, NeighborDemographics]
+  
+  def ancestors(maternal = true, paternal = true)
+    paternal_ancestors = ['p_ancestor1', 'p_ancestor2']
+    maternal_ancestors = ['m_ancestor1', 'm_ancestor2']
+    (maternal ? maternal_ancestors : []) + (paternal ? paternal_ancestors : [])
+  end
+  
+  proxy :ancestors do
+    def men
+      proxy_target.select { |ancestor| ancestor[-1, 1] == '1' }
+    end
+    
+    def women
+      proxy_target.select { |ancestor| ancestor[-1, 1] == '2' }
+    end
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/fixtures/person.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,4 +32,23 @@ describe &quot;Roxy&quot; do
     @person.neighbors.nearby?.should be_true
     @person.neighbors.caucasian?.should be_false
   end
+  
+  it &quot;should be able to pass arguments through the proxy&quot; do
+    @person.ancestors(true, false).should == ['m_ancestor1', 'm_ancestor2']
+    @person.ancestors(false, true).should == ['p_ancestor1', 'p_ancestor2']
+    @person.ancestors(true, true).should == ['m_ancestor1', 'm_ancestor2'] + ['p_ancestor1', 'p_ancestor2']    
+  end
+  
+  it &quot;should be able to retain default argument values&quot; do
+    @person.ancestors.should == ['m_ancestor1', 'm_ancestor2'] + ['p_ancestor1', 'p_ancestor2'] 
+  end
+  
+  it &quot;should be able to call a proxy method through a method with arguments&quot; do
+    @person.ancestors(true, false).men.should == ['m_ancestor1']
+    @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']
+  end
 end
\ No newline at end of file</diff>
      <filename>spec/roxy_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>74929ea964f041165407365698e4c3d9305dbbbc</id>
    </parent>
  </parents>
  <author>
    <name>Ryan Daigle</name>
    <email>ryan.daigle@gmail.com</email>
  </author>
  <url>http://github.com/yfactorial/roxy/commit/583e0a6fba3ffe83975a7ab02bf36bc9a3b861af</url>
  <id>583e0a6fba3ffe83975a7ab02bf36bc9a3b861af</id>
  <committed-date>2008-11-13T18:57:20-08:00</committed-date>
  <authored-date>2008-11-13T18:57:20-08:00</authored-date>
  <message>Start on allowing methods with arguments to be proxied</message>
  <tree>76d7b0c1df01c961eb9195b58bbc9d9e2e4ef2e1</tree>
  <committer>
    <name>Ryan Daigle</name>
    <email>ryan.daigle@gmail.com</email>
  </committer>
</commit>
