<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -122,13 +122,11 @@ module AutoCode
             # check to see if some other thread loaded the constant before
             # we entered the lock.
             return const_get( cname ) if const_defined?( cname )
-            constructors = @autocode[:constructors].map do |k,v|
-              # v
-              k == true || /V2/ === cname.to_s || k == cname 
+            actions = []
+            @autocode[:constructors].each do |matcher,action|
+              actions.concat action if (matcher == true || matcher == cname || matcher === cname.to_s )
             end
-            # raise constructors.inspect
-            # constructors = @autocode[:constructors][true] + @autocode[:constructors][cname]
-            constructors.reverse.find { | a,c | c.call( cname ) and const_defined?( cname ) }
+            actions.reverse!.find { | c | c.call( cname ) and const_defined?( cname ) }
             return old.call( cname ) unless const_defined?( cname )          
             initializers = @autocode[:initializers][true] + @autocode[:initializers][cname]
             mod = const_get( cname ); initializers.each { |init| init.call( mod ) }
@@ -140,4 +138,5 @@ module AutoCode
     end
   end
 end
-Autocode = AutoCode
\ No newline at end of file
+Autocode = AutoCode
+</diff>
      <filename>lib/autocode.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,11 +18,11 @@ describe &quot;auto_create&quot; do
     end
   end
   
-  specify &quot;allows you create and initialize a given const name&quot; do
+  it &quot;allows you create and initialize a given const name&quot; do
     A::B.smurf.should == &quot;blue&quot;
   end
   
-  specify &quot;allows you create and initialize const using a wildcard&quot; do
+  it &quot;allows you create and initialize const using a wildcard&quot; do
     A::B::C.pixie.should == &quot;brown&quot;
   end
   
@@ -48,18 +48,21 @@ describe &quot;auto_create&quot; do
     L::WONK::KNOW.foo.should == &quot;bar&quot;
   end
   
-  specify &quot;raises a NameError if a const doesn't match&quot; do
+  it &quot;raises a NameError if a const doesn't match&quot; do
     lambda{ A::C }.should.raise NameError
   end
   
-  # it &quot;can take a Regexp as a key&quot; do
-  #   module M
-  #     include AutoCode
-  #     auto_create_module(/V\d+/) do
-  #       Thing = self.name.split(&quot;::&quot;).last.reverse
-  #     end
-  #   end
-  #   M::V2::Thing.should == &quot;2V&quot;
-  # end
+  it &quot;can take a Regexp as a key&quot; do
+    module M
+      include AutoCode
+      auto_create_module(/V\d+/) do
+        def self.thing
+          name.split(&quot;::&quot;).last.reverse
+        end
+      end
+    end
+    M::V2.thing.should == &quot;2V&quot;
+    M::V3.thing.should == &quot;3V&quot;
+  end
   
 end
\ No newline at end of file</diff>
      <filename>test/auto_create.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>48818e0627fbaff5aa1b4cf416edbd3560c425fc</id>
    </parent>
  </parents>
  <author>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </author>
  <url>http://github.com/dyoder/autocode/commit/7410d58a0aeceecf21c65d28cbd1b5174eeb4800</url>
  <id>7410d58a0aeceecf21c65d28cbd1b5174eeb4800</id>
  <committed-date>2009-03-06T07:21:22-08:00</committed-date>
  <authored-date>2009-03-06T07:21:22-08:00</authored-date>
  <message>allow regex as cname matcher</message>
  <tree>a717a566e5ec5a2226ba83aa153a9e14341b2b87</tree>
  <committer>
    <name>Matthew King</name>
    <email>automatthew@gmail.com</email>
  </committer>
</commit>
