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