Class: JsonapiErrorsHandler::KeysStringifier
- Inherits:
-
Object
- Object
- JsonapiErrorsHandler::KeysStringifier
- Defined in:
- lib/jsonapi_errors_handler/keys_stringifier.rb
Overview
Allows to stringify keys on the given hash
Class Method Summary collapse
Class Method Details
.call(hash) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/jsonapi_errors_handler/keys_stringifier.rb', line 7 def self.call(hash) hash.reduce({}) do |h, (k, v)| new_val = v.is_a?(Hash) ? call(v) : v h.merge(k.to_s => new_val) end end |