Class: Rails::Rack::Metal
Constant Summary collapse
- NotFoundResponse =
[404, {}, []].freeze
- NotFound =
lambda { NotFoundResponse }
Class Method Summary collapse
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Metal
constructor
A new instance of Metal.
Constructor Details
#initialize(app) ⇒ Metal
Returns a new instance of Metal.
35 36 37 38 39 40 |
# File 'lib/rails/rack/metal.rb', line 35 def initialize(app) @app = app = ActiveSupport::OrderedHash.new self.class..each { |app| [app] = true } freeze end |
Class Method Details
.metals ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails/rack/metal.rb', line 13 def self. matcher = /#{Regexp.escape('/app/metal/')}(.*)\.rb\Z/ = .map{ |base| "#{base}/**/*.rb" } = {} .each do |glob| Dir[glob].sort.map do |file| file = file.match(matcher)[1] [file.camelize] = file end end load_list = || .keys load_list.map do || if = [] require_dependency .constantize end end.compact end |
Instance Method Details
#call(env) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/rails/rack/metal.rb', line 42 def call(env) .keys.each do |app| result = app.call(env) return result unless result[0].to_i == 404 end @app.call(env) end |