class Pakyow::Connection::Statuses
@api private
Constants
- CODE_TO_DESCRIPTION
- SYMBOL_TO_CODE
Public Class Methods
code(code_or_symbol)
click to toggle source
Returns the status code for the symbolized status name.
@example
Pakyow::Connection::Statuses.code(:ok) => 200 Pakyow::Connection::Statuses.code(200) => 200
# File lib/pakyow/connection/statuses.rb, line 103 def code(code_or_symbol) case code_or_symbol when Symbol SYMBOL_TO_CODE[code_or_symbol] else code_or_symbol = code_or_symbol.to_i if CODE_TO_DESCRIPTION.key?(code_or_symbol) code_or_symbol else nil end end end
describe(code_or_symbol)
click to toggle source
Returns the string representation for a status code or symbolized status name.
@example
Pakyow::Connection::Statuses.describe(200) => "OK" Pakyow::Connection::Statuses.describe(:ok) => "OK"
# File lib/pakyow/connection/statuses.rb, line 90 def describe(code_or_symbol) CODE_TO_DESCRIPTION[code(code_or_symbol)] || "?" end