diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-28 19:47:09 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-28 19:47:09 -0800 |
commit | 46bb4242874fe716268e3bb7b1ce3bb3c2d883e4 (patch) | |
tree | 31c354d04dea33f31b2a317febb8909ae67de073 /actionpack/lib/action_dispatch | |
parent | f279422e3346314ebec6b2156534c0fa5ebd5a98 (diff) | |
download | rails-46bb4242874fe716268e3bb7b1ce3bb3c2d883e4.tar.gz rails-46bb4242874fe716268e3bb7b1ce3bb3c2d883e4.tar.bz2 rails-46bb4242874fe716268e3bb7b1ce3bb3c2d883e4.zip |
Revert "compute ext in initialize, and use an attr_reader"
This reverts commit 2dbb73bdda3b81947fd112486ac4285fb1a6e3a9.
Conflicts:
actionpack/lib/action_dispatch/middleware/static.rb
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb index c5598f3e56..5076567bd4 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -2,16 +2,11 @@ require 'rack/utils' module ActionDispatch class FileHandler - attr_reader :ext - def initialize(at, root) @at, @root = at.chomp('/'), root.chomp('/') @compiled_at = /^#{Regexp.escape(at)}/ unless @at.blank? @compiled_root = /^#{Regexp.escape(root)}/ @file_server = ::Rack::File.new(@root) - - ext = ::ActionController::Base.page_cache_extension - @ext = "{,#{ext},/index#{ext}}" end def match?(path) @@ -32,6 +27,13 @@ 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 |