<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -236,8 +236,40 @@ module Merb
         route.generate(params, defaults)
       end
       
-      private
-      
+      # Add functionality to the router. This can be in the form of
+      # including a new module or directly defining new methods.
+      #
+      # ==== Parameters
+      # &amp;block&lt;Block&gt;::
+      #   A block of code used to extend the route builder with. This
+      #   can be including a module or directly defining some new methods
+      #   that should be available to building routes.
+      #
+      # ==== Example
+      # Merb::Router.extensions do
+      #   def domain(name, domain, options={}, &amp;block)
+      #     match(:domain =&gt; domain).namespace(name, :path =&gt; nil, &amp;block)
+      #   end
+      # end
+      #
+      # In this case, a method 'domain' will be available to the route builder
+      # which will create namespaces around domains instead of path prefixes.
+      #
+      # This can then be used as follows.
+      #
+      # Merb::Router.prepare do
+      #   domain(:admin, &quot;my-admin.com&quot;) do
+      #     # ... routes come here ...
+      #   end
+      # end
+      # ---
+      # @api public
+      def extensions(&amp;block)
+        Router::Behavior.class_eval(&amp;block)
+      end
+
+    private
+    
       # Compiles the routes and creates the +match+ method.
       # 
       # @api private</diff>
      <filename>lib/merb-core/dispatch/router.rb</filename>
    </modified>
    <modified>
      <diff>@@ -272,11 +272,7 @@ module Merb
       end
 
     end # Resources
-    
-    class Behavior
-      include Resources
-    end
-    
+
     # Adding the collection and member methods to behavior
     class ResourceBehavior &lt; Behavior #:nodoc:
       
@@ -301,5 +297,9 @@ module Merb
       end
       
     end
+    
+    class Behavior
+      include Resources
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/merb-core/dispatch/router/resources.rb</filename>
    </modified>
    <modified>
      <diff>@@ -145,7 +145,7 @@ describe Merb::Router do
     end
     
     it &quot;should not be able to match routes anymore&quot; do
-      lambda { route_for(&quot;/users&quot;) }
+      lambda { route_for(&quot;/users&quot;) }.should raise_error(Merb::Router::NotCompiledError)
     end
     
   end
@@ -157,5 +157,21 @@ describe Merb::Router do
     end
 
   end
+  
+  describe &quot;#extensions&quot; do
+    it &quot;should be able to extend the router&quot; do
+      Merb::Router.extensions do
+        def hello_world
+          match(&quot;/hello&quot;).to(:controller =&gt; &quot;world&quot;)
+        end
+      end
+      
+      Merb::Router.prepare do
+        hello_world
+      end
+      
+      route_for(&quot;/hello&quot;).should have_route(:controller =&gt; &quot;world&quot;)
+    end
+  end
 
 end
\ No newline at end of file</diff>
      <filename>spec/public/router/router_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>209ca502a6e44f3115042f90b90caec6f82580ed</id>
    </parent>
  </parents>
  <author>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </author>
  <url>http://github.com/wycats/merb-core/commit/72f7c7ef3a2ce6a0a0f409b2092e64da7d0795cf</url>
  <id>72f7c7ef3a2ce6a0a0f409b2092e64da7d0795cf</id>
  <committed-date>2008-10-12T16:22:08-07:00</committed-date>
  <authored-date>2008-10-12T16:15:22-07:00</authored-date>
  <message>Added Merb::Router.extensions as an official API.

Merb::Router.extensions is now the official way to add functionality
to the router.</message>
  <tree>b5434d3139a1401454adc3a68868e3a15d5159e6</tree>
  <committer>
    <name>Carl Lerche</name>
    <email>carllerche@mac.com</email>
  </committer>
</commit>
