Method: Attributor::Hash.load_generic

Defined in:
lib/attributor/types/hash.rb

.load_generic(value, context) ⇒ Object



303
304
305
306
307
308
309
# File 'lib/attributor/types/hash.rb', line 303

def self.load_generic(value, context)
  return new(value) if key_type == Object && value_type == Object

  value.each_with_object(new) do |(k, v), obj|
    obj[key_type.load(k, context)] = value_type.load(v, context)
  end
end