Class: Rack::IndexFile
- Inherits:
-
File
- Object
- File
- Rack::IndexFile
- Defined in:
- lib/rack/index_file.rb
Constant Summary collapse
- F =
::File
Instance Method Summary collapse
- #_call(env) ⇒ Object
-
#initialize(root, headers = {}, default_mime = 'text/plain') ⇒ IndexFile
constructor
A new instance of IndexFile.
Constructor Details
Instance Method Details
#_call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rack/index_file.rb', line 12 def _call(env) unless ALLOWED_VERBS.include? env[REQUEST_METHOD] return fail(405, "Method Not Allowed", {'Allow' => ALLOW_HEADER}) end available = begin F.file?(@path) && F.readable?(@path) rescue SystemCallError false end if available serving(env) else fail(404, "File not found: #{path_info}") end end |