class HTTP::Response::Status
def coerce(object)
-
(Status)
-
Parameters:
-
object
(Symbol, #to_i
) --
Raises:
-
(Error)
- if coercion is impossible
def coerce(object) code = case when object.is_a?(String) then SYMBOL_CODES[symbolize object] when object.is_a?(Symbol) then SYMBOL_CODES[object] when object.is_a?(Numeric) then object.to_i end return new code if code raise Error, "Can't coerce #{object.class}(#{object}) to #{self}" end