<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/matchy/matcher_builder.rb</filename>
    </added>
    <added>
      <filename>test/test_matcher_builder.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1,3 @@
 pkg/*
+.DS_Store
+</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,7 @@ require 'test/unit'
 require 'matchy/expectation'
 require 'matchy/modals'
 require 'matchy/version'
+require 'matchy/matcher_builder'
 require 'matchy/def_matcher'
 
 require 'matchy/built_in/enumerable_expectations'</diff>
      <filename>lib/matchy.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,45 +1,9 @@
 module Matchy
   module DefMatcher
+    include Matchy::MatcherBuilder
     def def_matcher(matcher_name, &amp;block)
       self.class.send :define_method, matcher_name do |*args|
-        match_block = lambda do |actual, matcher|
-          block.call(actual, matcher, args)
-        end
-        body = lambda do |klass|
-          @matcher_name = matcher_name.to_s
-          def self.matcher_name
-            @matcher_name
-          end
-
-          attr_accessor :positive_msg, :negative_msg, :msgs
-          attr_reader :matcher_name
-          def initialize match_block, test_case
-            @test_case = test_case
-            @match_block = match_block
-            @matcher_name = self.class.matcher_name
-          end
-
-          def method_missing id, *args, &amp;block
-            require 'ostruct'
-            (self.msgs ||= []) &lt;&lt; OpenStruct.new( &quot;name&quot; =&gt; id, &quot;args&quot; =&gt; args, &quot;block&quot; =&gt; block ) 
-            self
-          end
-
-          def matches? given
-            @positive_msg ||= &quot;Matching with '#{matcher_name}' failed, although it should match.&quot;
-            @negative_msg ||= &quot;Matching with '#{matcher_name}' passed, although it should_not match.&quot;
-            @match_block.call(given, self)
-          end
-
-          def failure_message
-            self.positive_msg
-          end
-
-          def negative_failure_message
-            self.negative_msg
-          end
-        end
-        Class.new(Matchy::Expectations::Base, &amp;body).new(match_block, self)
+        build_matcher(matcher_name, args, &amp;block)
       end
     end
   end</diff>
      <filename>lib/matchy/def_matcher.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,7 +29,7 @@ class TestDefMatcher &lt; Test::Unit::TestCase
     def_matcher :matcher do |given, matcher, args|
       true
     end
-    lambda {1.should matcher}.should_not raise_error
+    1.should matcher
   end
   
   def test_fail_negative
@@ -43,7 +43,7 @@ class TestDefMatcher &lt; Test::Unit::TestCase
     def_matcher :matcher do |given, matcher, args|
       false
     end
-    lambda {1.should_not matcher}.should_not raise_error
+    1.should_not matcher
   end
   
   def test_takes_arguments</diff>
      <filename>test/test_def_matcher.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b90775acfc35ab16dfed2b5ed0a9c2720c3911d5</id>
    </parent>
  </parents>
  <author>
    <name>Matthias Hennemeyer</name>
    <email>mhennemeyer@gmail.com</email>
  </author>
  <url>http://github.com/technicalpickles/matchy/commit/07e1378a99ab6c4210882a1c48037bc026c8af62</url>
  <id>07e1378a99ab6c4210882a1c48037bc026c8af62</id>
  <committed-date>2009-02-10T23:18:51-08:00</committed-date>
  <authored-date>2009-02-06T01:51:46-08:00</authored-date>
  <message>Refactored def_matcher(), introduced build_matcher method.

Signed-off-by: Jeremy McAnally &lt;jeremymcanally@gmail.com&gt;</message>
  <tree>3e22219ea74bd3896ccefb622486b9904cf6ede9</tree>
  <committer>
    <name>Jeremy McAnally</name>
    <email>jeremymcanally@gmail.com</email>
  </committer>
</commit>
