aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/metal_loader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/application/metal_loader.rb')
-rw-r--r--railties/lib/rails/application/metal_loader.rb50
1 files changed, 0 insertions, 50 deletions
diff --git a/railties/lib/rails/application/metal_loader.rb b/railties/lib/rails/application/metal_loader.rb
deleted file mode 100644
index 2a43fa7892..0000000000
--- a/railties/lib/rails/application/metal_loader.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-require 'action_dispatch'
-
-module Rails
- class Application
- class MetalLoader
- attr_reader :paths, :metals
-
- def initialize
- @paths, @metals = [], []
- end
-
- def build_middleware(list=nil)
- load_metals!(list)
- self
- end
-
- def new(app)
- ActionDispatch::Cascade.new(@metals, app)
- end
-
- def name
- ActionDispatch::Cascade.name
- end
- alias :to_s :name
-
- protected
-
- def load_metals!(list)
- metals = []
- list = Array(list || :all).map(&:to_sym)
-
- paths.each do |path|
- matcher = /\A#{Regexp.escape(path)}\/(.*)\.rb\Z/
- Dir.glob("#{path}/**/*.rb").sort.each do |metal_path|
- metal = metal_path.sub(matcher, '\1').to_sym
- next unless list.include?(metal) || list.include?(:all)
- require_dependency metal.to_s
- metals << metal
- end
- end
-
- metals = metals.sort_by do |m|
- [list.index(m) || list.index(:all), m.to_s]
- end
-
- @metals = metals.map { |m| m.to_s.camelize.constantize }
- end
- end
- end
-end