Module: Rack::Response::Helpers

Included in:
Rack::Response
Defined in:
lib/rack/response.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) headers (readonly)

Headers



137
138
139
# File 'lib/rack/response.rb', line 137

def headers
  @headers
end

- (Object) original_headers (readonly)

Headers



137
138
139
# File 'lib/rack/response.rb', line 137

def original_headers
  @original_headers
end

Instance Method Details

- (Boolean) accepted?



126
# File 'lib/rack/response.rb', line 126

def accepted?;           status == 202;                        end

- (Boolean) bad_request?



127
# File 'lib/rack/response.rb', line 127

def bad_request?;        status == 400;                        end

- (Boolean) client_error?



121
# File 'lib/rack/response.rb', line 121

def client_error?;       status >= 400 && status < 500;        end

- (Object) content_length



147
148
149
150
# File 'lib/rack/response.rb', line 147

def content_length
  cl = headers["Content-Length"]
  cl ? cl.to_i : cl
end

- (Object) content_type



143
144
145
# File 'lib/rack/response.rb', line 143

def content_type
  headers["Content-Type"]
end

- (Boolean) created?



125
# File 'lib/rack/response.rb', line 125

def created?;            status == 201;                        end

- (Boolean) forbidden?



129
# File 'lib/rack/response.rb', line 129

def forbidden?;          status == 403;                        end

- (Boolean) include?(header)



139
140
141
# File 'lib/rack/response.rb', line 139

def include?(header)
  !!headers[header]
end

- (Boolean) informational?



118
# File 'lib/rack/response.rb', line 118

def informational?;      status >= 100 && status < 200;        end

- (Boolean) invalid?



116
# File 'lib/rack/response.rb', line 116

def invalid?;            status < 100 || status >= 600;        end

- (Object) location



152
153
154
# File 'lib/rack/response.rb', line 152

def location
  headers["Location"]
end

- (Boolean) method_not_allowed?



131
# File 'lib/rack/response.rb', line 131

def method_not_allowed?; status == 405;                        end

- (Boolean) not_found?



130
# File 'lib/rack/response.rb', line 130

def not_found?;          status == 404;                        end

- (Boolean) ok?



124
# File 'lib/rack/response.rb', line 124

def ok?;                 status == 200;                        end

- (Boolean) redirect?



134
# File 'lib/rack/response.rb', line 134

def redirect?;           [301, 302, 303, 307].include? status; end

- (Boolean) redirection?



120
# File 'lib/rack/response.rb', line 120

def redirection?;        status >= 300 && status < 400;        end

- (Boolean) server_error?



122
# File 'lib/rack/response.rb', line 122

def server_error?;       status >= 500 && status < 600;        end

- (Boolean) successful?



119
# File 'lib/rack/response.rb', line 119

def successful?;         status >= 200 && status < 300;        end

- (Boolean) unauthorized?



128
# File 'lib/rack/response.rb', line 128

def unauthorized?;       status == 401;                        end

- (Boolean) unprocessable?



132
# File 'lib/rack/response.rb', line 132

def unprocessable?;      status == 422;                        end