class Heel::Request

nothing more than a rack request with some additional methods and overriding where the erros get written

Attributes

root_dir[R]

Public Class Methods

new(env, root_dir) click to toggle source

Initialize the request with the environment and the root directory of the request

Calls superclass method
# File lib/heel/request.rb, line 16
def initialize(env, root_dir)
  super(env)
  @root_dir = root_dir
end

Public Instance Methods

base_uri() click to toggle source
# File lib/heel/request.rb, line 35
def base_uri
  @base_uri ||= ::Rack::Utils.unescape(path_info)
end
for_directory?() click to toggle source
# File lib/heel/request.rb, line 52
def for_directory?
  stat.directory?
end
for_file?() click to toggle source
# File lib/heel/request.rb, line 56
def for_file?
  stat.file?
end
forbidden?() click to toggle source

a request must be for something that below the root directory

# File lib/heel/request.rb, line 42
def forbidden?
  request_path.index(root_dir) != 0
end
found?() click to toggle source

a request is only good for something that actually exists and is readable

# File lib/heel/request.rb, line 48
def found?
  File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?
end
highlighting?() click to toggle source

was the highlighting parameter true or false?

# File lib/heel/request.rb, line 62
def highlighting?
  return !(%w[ off false ].include? self.GET['highlighting'].to_s.downcase)
end
request_path() click to toggle source

normalize the request path to the full file path of the request from the root_dir

# File lib/heel/request.rb, line 30
def request_path
  @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))
end
stat() click to toggle source

a stat of the file mentioned in the request path

# File lib/heel/request.rb, line 23
def stat
  @stat ||= ::File.stat(request_path) 
end