aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/rack
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-17 13:23:14 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-17 13:23:38 +0100
commit020e656447a7cc2ce9cbf83483ab3b31730a565e (patch)
treeea147ea25a768989e6aaaa57ea026dada4d2f053 /railties/lib/rails/rack
parent27d9836ad3519d57462b86a4e539c1aa176b6d95 (diff)
downloadrails-020e656447a7cc2ce9cbf83483ab3b31730a565e.tar.gz
rails-020e656447a7cc2ce9cbf83483ab3b31730a565e.tar.bz2
rails-020e656447a7cc2ce9cbf83483ab3b31730a565e.zip
Move middleware builder back to Rails::Rack::Metal without losing the new behavior.
Diffstat (limited to 'railties/lib/rails/rack')
-rw-r--r--railties/lib/rails/rack/metal.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb
new file mode 100644
index 0000000000..565f95d7c4
--- /dev/null
+++ b/railties/lib/rails/rack/metal.rb
@@ -0,0 +1,26 @@
+require 'action_dispatch'
+
+module Rails
+ module Rack
+ class Metal
+ def initialize(metal_roots, metals=nil)
+ load_list = metals || Dir["{#{metal_roots.join(",")}}/**/*.rb"]
+
+ @metals = load_list.map { |metal|
+ metal = File.basename(metal, '.rb')
+ require_dependency metal
+ metal.camelize.constantize
+ }.compact
+ end
+
+ def new(app)
+ ActionDispatch::Cascade.new(@metals, app)
+ end
+
+ def name
+ ActionDispatch::Cascade.name
+ end
+ alias_method :to_s, :name
+ end
+ end
+end