summary refs log tree commit
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2015-09-04 11:24:21 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2015-09-04 11:24:21 -0700
commit5d4dcd3b8c7538c19794592aba04bb91e868a5d4 (patch)
treea6ec1590b17659701be32183d09795d89be25ad9
parent714eea002482cc2097cd3423a28782b9069005dd (diff)
downloadrack-5d4dcd3b8c7538c19794592aba04bb91e868a5d4.tar.gz
remove `@env` instance variable
again, trying to remove coupling to the instance
-rw-r--r--lib/rack/directory.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/rack/directory.rb b/lib/rack/directory.rb
index c274faf3..195cbf3f 100644
--- a/lib/rack/directory.rb
+++ b/lib/rack/directory.rb
@@ -52,7 +52,6 @@ table { width:100%%; }
     end
 
     def _call(env)
-      @env = env
       @script_name = env[SCRIPT_NAME]
       path_info = Utils.unescape(env[PATH_INFO])
 
@@ -60,7 +59,7 @@ table { width:100%%; }
         forbidden
       else
         @path = ::File.join(@root, path_info)
-        list_path(path_info)
+        list_path(env, path_info)
       end
     end
 
@@ -110,11 +109,11 @@ table { width:100%%; }
 
     # TODO: add correct response if not readable, not sure if 404 is the best
     #       option
-    def list_path(path_info)
+    def list_path(env, path_info)
       @stat = ::File.stat(@path)
 
       if @stat.readable?
-        return @app.call(@env) if @stat.file?
+        return @app.call(env) if @stat.file?
         return list_directory(path_info) if @stat.directory?
       else
         raise Errno::ENOENT, 'No such file or directory'