<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.autotest</filename>
    </added>
    <added>
      <filename>lib/core_ext/method.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,17 +1,6 @@
 module H2o
   require 'pathname'
 
-  class Stream &lt; Array
-    
-    def &lt;&lt; (item)
-      unshift item.to_s
-    end
-    
-    def close
-      reverse!
-    end
-  end
-
   class Template
     attr_reader :context
     
@@ -42,6 +31,7 @@ module H2o
 end
 
 require File.dirname(__FILE__) + '/core_ext/object'
+require File.dirname(__FILE__) + '/core_ext/method'
 
 require File.dirname(__FILE__) + '/h2o/constants'
 require File.dirname(__FILE__) + '/h2o/errors'</diff>
      <filename>lib/h2o.rb</filename>
    </modified>
    <modified>
      <diff>@@ -90,9 +90,9 @@ module H2o
     def apply_filters(object, filters)
       filters.each do |filter|
         name, *args = filter
-        
         filter = Filters[name] 
-        raise FilterError, &quot;Filter not found&quot; if filter.nil?
+        
+        raise FilterError, &quot;Filter(#{name}) not found&quot; if filter.nil?
         
         args.map! do |arg|
           if arg.kind_of? Symbol
@@ -101,6 +101,7 @@ module H2o
             arg
           end
         end
+        
         object = filter.call(object, *args)
       end
       object</diff>
      <filename>lib/h2o/context.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,11 @@
 module H2o
-  
-  class StreamWriter
+  class Stream &lt; Array
+    def &lt;&lt; (item)
+      unshift item.to_s
+    end
     
+    def close
+      reverse!
+    end
   end
-  
 end
\ No newline at end of file</diff>
      <filename>lib/h2o/datatype.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,8 @@ module H2o
   end
   
   class StandardFilters &lt; FilterCollection
+    
+    # String filters
     def upper value
       value.to_s.upcase
     end
@@ -30,8 +32,20 @@ module H2o
       value.gsub!(/&quot;/, '&amp;quot;') if attribute
       value
     end
-
     
+    # Array Filters
+    def join(value, delimiter = ', ')
+      value.join(delimiter)
+    end
+    
+    def first(value)
+      value.first
+    end
+    
+    def last(value)
+      value.last
+    end
+
     def test value, arg1, arg2
       &quot;#{value} #{arg1} #{arg2}&quot; 
     end</diff>
      <filename>lib/h2o/filters.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,37 @@
 require 'spec/spec_helper'
 require 'pp'
 
+describe &quot;Filter parameter passing&quot; do
+  it &quot;should pass input object as first param&quot; do
+    
+    # try a standard filter
+    parse('{{ &quot;something&quot; | upper }}').render.should == 'SOMETHING'
+    
+
+    # try a array input object
+    H2o::Filters.add(:test_filter) do |input|
+      &quot;#{input.inspect}&quot;
+    end
+    
+    list = [&quot;man&quot;,&quot;women&quot;]
+    result = parse('{{ object| test_filter }}').render(:object =&gt; list)
+    result.should == list.inspect
+    
+    # Try a array subclass
+    list = CustomCollection.new([&quot;man&quot;, &quot;woman&quot;])
+    
+    result = parse('{{ object| test_filter }}').render(:object =&gt; list)
+    result.should == list.inspect
+  end
+  
+  it &quot;should be able to pass aditional parameters&quot; do
+    H2o::Filters.add(:test_filter) do |string, param1, param2|
+      &quot;#{string}-#{param1}-#{param2}&quot;
+    end
+    parse('{{ &quot;test&quot;| test_filter 1, 2 }}').render.should == 'test-1-2'
+  end
+end
+
 describe 'Standard Filters' do
   it &quot;should upcase an string&quot; do
       parse('{{ &quot;test&quot; | upper }}').render.should == 'TEST'
@@ -10,4 +41,6 @@ end
 
 def parse src
   H2o::Template.parse(src)
-end
\ No newline at end of file
+end
+
+class CustomCollection &lt; Array; end
\ No newline at end of file</diff>
      <filename>spec/filters_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ef689895b4a5e887f94636be08872f8af76a2664</id>
    </parent>
  </parents>
  <author>
    <name>speedmax</name>
    <email>subjective@gmail.com</email>
  </author>
  <url>http://github.com/speedmax/h2o/commit/a2bfa272f680ed05929b9534deea14c54a136fc8</url>
  <id>a2bfa272f680ed05929b9534deea14c54a136fc8</id>
  <committed-date>2009-05-31T01:10:52-07:00</committed-date>
  <authored-date>2009-05-31T01:10:52-07:00</authored-date>
  <message> - Fixed filter argument dispatching issue, patched Method#to_proc with Method#filter_to_proc
 - Updated specs
 - Cleanup h2o class
 - Better filter missing warning
 - adding .autotest </message>
  <tree>09c28c70592afd1904dacd2f088ac115c1788842</tree>
  <committer>
    <name>speedmax</name>
    <email>subjective@gmail.com</email>
  </committer>
</commit>
