Class Heel::Request
In: lib/heel/request.rb
lib/heel/request.rb
Parent: ::Rack::Request

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

Methods

Attributes

root_dir  [R] 
root_dir  [R] 

Public Class methods

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

[Source]

    # File lib/heel/request.rb, line 16
16:     def initialize(env, root_dir)
17:       super(env)
18:       @root_dir = root_dir
19:     end

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

[Source]

    # File lib/heel/request.rb, line 16
16:     def initialize(env, root_dir)
17:       super(env)
18:       @root_dir = root_dir
19:     end

Public Instance methods

[Source]

    # File lib/heel/request.rb, line 35
35:     def base_uri
36:       @base_uri ||= ::Rack::Utils.unescape(path_info)
37:     end

[Source]

    # File lib/heel/request.rb, line 35
35:     def base_uri
36:       @base_uri ||= ::Rack::Utils.unescape(path_info)
37:     end

[Source]

    # File lib/heel/request.rb, line 52
52:     def for_directory?
53:       stat.directory?
54:     end

[Source]

    # File lib/heel/request.rb, line 52
52:     def for_directory?
53:       stat.directory?
54:     end

[Source]

    # File lib/heel/request.rb, line 56
56:     def for_file?
57:       stat.file?
58:     end

[Source]

    # File lib/heel/request.rb, line 56
56:     def for_file?
57:       stat.file?
58:     end

a request must be for something that below the root directory

[Source]

    # File lib/heel/request.rb, line 42
42:     def forbidden?
43:       request_path.index(root_dir) != 0
44:     end

a request must be for something that below the root directory

[Source]

    # File lib/heel/request.rb, line 42
42:     def forbidden?
43:       request_path.index(root_dir) != 0
44:     end

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

[Source]

    # File lib/heel/request.rb, line 48
48:     def found?
49:       File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?
50:     end

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

[Source]

    # File lib/heel/request.rb, line 48
48:     def found?
49:       File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?
50:     end

was the highlighting parameter true or false?

[Source]

    # File lib/heel/request.rb, line 62
62:     def highlighting?
63:       return !(%w[ off false ].include? self.GET['highlighting'].to_s.downcase)
64:     end

was the highlighting parameter true or false?

[Source]

    # File lib/heel/request.rb, line 62
62:     def highlighting?
63:       return !(%w[ off false ].include? self.GET['highlighting'].to_s.downcase)
64:     end

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

[Source]

    # File lib/heel/request.rb, line 30
30:     def request_path
31:       @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))
32:     end

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

[Source]

    # File lib/heel/request.rb, line 30
30:     def request_path
31:       @request_path ||= ::File.expand_path(::File.join(root_dir, ::Rack::Utils.unescape(path_info)))
32:     end

a stat of the file mentioned in the request path

[Source]

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

a stat of the file mentioned in the request path

[Source]

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

[Validate]