mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "compute ext in initialize, and use an attr_reader"
This reverts commit 2dbb73bdda
.
Conflicts:
actionpack/lib/action_dispatch/middleware/static.rb
This commit is contained in:
parent
f279422e33
commit
46bb424287
1 changed files with 7 additions and 5 deletions
|
@ -2,16 +2,11 @@ require 'rack/utils'
|
||||||
|
|
||||||
module ActionDispatch
|
module ActionDispatch
|
||||||
class FileHandler
|
class FileHandler
|
||||||
attr_reader :ext
|
|
||||||
|
|
||||||
def initialize(at, root)
|
def initialize(at, root)
|
||||||
@at, @root = at.chomp('/'), root.chomp('/')
|
@at, @root = at.chomp('/'), root.chomp('/')
|
||||||
@compiled_at = /^#{Regexp.escape(at)}/ unless @at.blank?
|
@compiled_at = /^#{Regexp.escape(at)}/ unless @at.blank?
|
||||||
@compiled_root = /^#{Regexp.escape(root)}/
|
@compiled_root = /^#{Regexp.escape(root)}/
|
||||||
@file_server = ::Rack::File.new(@root)
|
@file_server = ::Rack::File.new(@root)
|
||||||
|
|
||||||
ext = ::ActionController::Base.page_cache_extension
|
|
||||||
@ext = "{,#{ext},/index#{ext}}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def match?(path)
|
def match?(path)
|
||||||
|
@ -32,6 +27,13 @@ module ActionDispatch
|
||||||
def call(env)
|
def call(env)
|
||||||
@file_server.call(env)
|
@file_server.call(env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ext
|
||||||
|
@ext ||= begin
|
||||||
|
ext = ::ActionController::Base.page_cache_extension
|
||||||
|
"{,#{ext},/index#{ext}}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Static
|
class Static
|
||||||
|
|
Loading…
Reference in a new issue