aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/rack
diff options
context:
space:
mode:
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