Transfer-encoding: gzip
Magnus Naeslund
mag at kite.se
Sun Mar 18 16:08:43 EDT 2007
Magnus Naeslund wrote:
[snip]
> I patched merb so that I can add additional handlers in merb_init.rb, see patch below.
[snip]
Maybe I should attach the patch aswell :)
Magnus
Index: lib/merb/merb_server.rb
===================================================================
--- lib/merb/merb_server.rb (revision 198)
+++ lib/merb/merb_server.rb (working copy)
@@ -284,6 +284,11 @@
uri( "/", :handler => MerbUploadHandler.new(yconfig), :in_front => true) if @@merb_opts[:config]
uri "/", :handler => MerbHandler.new(@@merb_opts[:dist_root]+'/public')
uri "/favicon.ico", :handler => Mongrel::Error404Handler.new("")
+ if @@additional_handlers
+ @@additional_handlers.each do |h|
+ uri(h[:uri], :handler => h[:handler], :in_front => (h[:in_front] || false))
+ end
+ end
end
trap("INT") { stop }
@@ -295,7 +300,12 @@
def config
@@merb_opts
end
-
+
+ def add_handler(h)
+ @@additional_handlers ||= []
+ @@additional_handlers << h
+ end
+
end
end # Server
More information about the Merb-devel
mailing list