diff options
author | Yuki Nishijima <mail@yukinishijima.net> | 2015-06-11 04:34:11 -0700 |
---|---|---|
committer | Yuki Nishijima <mail@yukinishijima.net> | 2015-06-11 04:34:11 -0700 |
commit | a888c3cdc9b0280783861b4687409db619669ab2 (patch) | |
tree | e4d7b490293a4924c74ce6a8843782f1ab53c16a /actionpack/lib/action_dispatch/middleware | |
parent | 96bb004fc6e67cdf1b873f11ad5f8efd06949797 (diff) | |
download | rails-a888c3cdc9b0280783861b4687409db619669ab2.tar.gz rails-a888c3cdc9b0280783861b4687409db619669ab2.tar.bz2 rails-a888c3cdc9b0280783861b4687409db619669ab2.zip |
Change the `index` arg of `ActionDispatch::Static#new` to a kwarg
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index 3aa0eef4ad..b098ea389f 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -13,7 +13,7 @@ module ActionDispatch # located at `public/assets/application.js` if the file exists. If the file # does not exist, a 404 "File not Found" response will be returned. class FileHandler - def initialize(root, cache_control, index = 'index') + def initialize(root, cache_control, index: 'index') @root = root.chomp('/') @compiled_root = /^#{Regexp.escape(root)}/ headers = cache_control && { 'Cache-Control' => cache_control } @@ -21,7 +21,6 @@ module ActionDispatch @index = index end - # Takes a path to a file. If the file is found, has valid encoding, and has # correct read permissions, the return value is a URI-escaped string # representing the filename. Otherwise, false is returned. @@ -105,9 +104,9 @@ module ActionDispatch # produce a directory traversal using this middleware. Only 'GET' and 'HEAD' # requests will result in a file being returned. class Static - def initialize(app, path, cache_control = nil, index = 'index') + def initialize(app, path, cache_control = nil, index: 'index') @app = app - @file_handler = FileHandler.new(path, cache_control, index) + @file_handler = FileHandler.new(path, cache_control, index: index) end def call(env) |