# class ActionDispatch::Static

### Public Class Methods

new(app, path, cache_control=nil) click to toggle source

    # File lib/action_dispatch/middleware/static.rb, line 48
    def initialize(app, path, cache_control=nil)
      @app = app
      @file_handler = FileHandler.new(path, cache_control)
    end

### Public Instance Methods

call(env) click to toggle source

    # File lib/action_dispatch/middleware/static.rb, line 53
    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