Permalink
Browse files

Revert "compute ext in initialize, and use an attr_reader"

This reverts commit 2dbb73b.

Conflicts:

	actionpack/lib/action_dispatch/middleware/static.rb
  • Loading branch information...
1 parent f279422 commit 46bb4242874fe716268e3bb7b1ce3bb3c2d883e4 @tenderlove tenderlove committed Mar 1, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 actionpack/lib/action_dispatch/middleware/static.rb
@@ -2,16 +2,11 @@
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 @@ 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

0 comments on commit 46bb424

Please sign in to comment.