Module: Serve::WEBrick::FileHandlerExtensions

Defined in:
lib/serve/webrick/extensions.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/serve/webrick/extensions.rb', line 8

def self.included(base)
  base.extend(self)
  base.class_eval do
    alias :search_file_without_auto_appending :search_file
    alias :search_file :search_file_with_auto_appending
  end
end

Instance Method Details

#search_file_with_auto_appending(req, res, basename) ⇒ Object



16
17
18
19
20
21
# File 'lib/serve/webrick/extensions.rb', line 16

def search_file_with_auto_appending(req, res, basename)
  full_path = File.join(res.filename, basename)
  return basename if File.file?(full_path)
  return nil if File.directory?(full_path)
  Serve.resolve_file(Dir.pwd, req.path)
end