Method: AttributedObject::Types::HashOf#coerce
- Defined in:
- lib/attributed_object/types/hash_of.rb
#coerce(hash) ⇒ Object
16 17 18 19 |
# File 'lib/attributed_object/types/hash_of.rb', line 16 def coerce(hash) raise AttributedObject::UncoercibleValueError.new("Trying to coerce into Hash but value is not an hash") if !hash.is_a?(Hash) hash.map { |k,v| [AttributedObjectHelpers::TypeCoerce.coerce(@key_type_info, k), AttributedObjectHelpers::TypeCoerce.coerce(@value_type_info, v)] } end |