class Hanami::Http::Status

An HTTP status

@since 0.1.0 @api private

Constants

ALL

A set of standard codes and messages for HTTP statuses

@since 0.1.0 @api private

Public Class Methods

for_code(code) click to toggle source

Return a status for the given code

@param code [Fixnum] a valid HTTP code

@return [Array] a pair of code and message for an HTTP status

@since 0.1.0 @api private

@example

require 'hanami/http/status'

Hanami::Http::Status.for_code(418) # => [418, "I'm a teapot"]
# File lib/hanami/http/status.rb, line 45
def self.for_code(code)
  ALL.assoc(code)
end
message_for(code) click to toggle source

Return a message for the given status code

@param code [Fixnum] a valid HTTP code

@return [String] a message for the given status code

@since 0.3.2 @api private

# File lib/hanami/http/status.rb, line 57
def self.message_for(code)
  for_code(code)[1]
end