提交 c3c1a1e1 编写于 作者: P Piotr Sarnacki

Do not use ActionController::Base.page_cache_extension in initialize to not...

Do not use ActionController::Base.page_cache_extension in initialize to not load more ActiveSupport than we need
上级 9f0a1ae1
......@@ -7,16 +7,13 @@ def initialize(at, root)
@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)
path = path.dup
if @compiled_at.blank? || path.sub!(@compiled_at, '')
full_path = File.join(@root, ::Rack::Utils.unescape(path))
paths = "#{full_path}#{@ext}"
paths = "#{full_path}#{ext}"
matches = Dir[paths]
match = matches.detect { |m| File.file?(m) }
......@@ -30,6 +27,13 @@ def match?(path)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册