Class: ActionDispatch::Static
- Inherits:
-
Object
- Object
- ActionDispatch::Static
- Defined in:
- actionpack/lib/action_dispatch/middleware/static.rb
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (Static) initialize(app, path, cache_control = nil)
constructor
A new instance of Static.
Constructor Details
- (Static) initialize(app, path, cache_control = nil)
A new instance of Static
38 39 40 41 |
# File 'actionpack/lib/action_dispatch/middleware/static.rb', line 38 def initialize(app, path, cache_control=nil) @app = app @file_handler = FileHandler.new(path, cache_control) end |
Instance Method Details
- (Object) call(env)
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'actionpack/lib/action_dispatch/middleware/static.rb', line 43 def call(env) case env['REQUEST_METHOD'] when 'GET', 'HEAD' path = env['PATH_INFO'].chomp('/') if match = @file_handler.match?(path) env["PATH_INFO"] = match return @file_handler.call(env) end end @app.call(env) end |