Module: Rack::Response::Helpers

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headersObject (readonly)

Headers



133
134
135
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 133

def headers
  @headers
end

#original_headersObject (readonly)

Headers



133
134
135
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 133

def original_headers
  @original_headers
end

Instance Method Details

#bad_request?Boolean

Returns:

  • (Boolean)


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

def bad_request?;        status == 400;                        end

#client_error?Boolean

Returns:

  • (Boolean)


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

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

#content_lengthObject



143
144
145
146
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 143

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

#content_typeObject



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

def content_type
  headers["Content-Type"]
end

#forbidden?Boolean

Returns:

  • (Boolean)


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

def forbidden?;          status == 403;                        end

#include?(header) ⇒ Boolean

Returns:

  • (Boolean)


135
136
137
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 135

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

#informational?Boolean

Returns:

  • (Boolean)


117
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 117

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

#invalid?Boolean

Returns:

  • (Boolean)


115
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 115

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

#locationObject



148
149
150
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 148

def location
  headers["Location"]
end

#method_not_allowed?Boolean

Returns:

  • (Boolean)


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

def method_not_allowed?; status == 405;                        end

#not_found?Boolean

Returns:

  • (Boolean)


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

def not_found?;          status == 404;                        end

#ok?Boolean

Returns:

  • (Boolean)


123
# File 'lib/vendor/rack-1.5.2/lib/rack/response.rb', line 123

def ok?;                 status == 200;                        end

#redirect?Boolean

Returns:

  • (Boolean)


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

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

#redirection?Boolean

Returns:

  • (Boolean)


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

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

#server_error?Boolean

Returns:

  • (Boolean)


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

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

#successful?Boolean

Returns:

  • (Boolean)


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

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

#unprocessable?Boolean

Returns:

  • (Boolean)


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

def unprocessable?;      status == 422;                        end