Sha256: 49587a11e8cca6255e6453b40c020ef60b1f11a8d2638b21fa7a14d3c6206848
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require "rack/utils" module Hanami module Http # An HTTP status # # @since 0.1.0 # @api private class Status # A set of standard codes and messages for HTTP statuses # # @since 0.1.0 # @api private ALL = ::Rack::Utils::HTTP_STATUS_CODES # Return a status for the given code # # @param code [Integer] 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"] def self.for_code(code) ALL.assoc(code) end # Return a message for the given status code # # @param code [Integer] a valid HTTP code # # @return [String] a message for the given status code # # @since 0.3.2 # @api private def self.message_for(code) for_code(code)[1] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hanami-controller-2.0.0.beta4 | lib/hanami/http/status.rb |
hanami-controller-2.0.0.beta1 | lib/hanami/http/status.rb |