Sha256: 06fd6b937ab0de18b15da4acb3e80ed594644be6e3c389e2a5472fb1885b8f47
Contents?: true
Size: 470 Bytes
Versions: 3
Compression:
Stored size: 470 Bytes
Contents
# encoding: utf-8 module Mixture module Coerce # Handles coercion of the Hash class. class Hash < Base type Types::Hash coerce_to(Types::Object, Itself) coerce_to(Types::Boolean, :any?) coerce_to(Types::Hash) do |value, type| members = type.options.fetch(:members) ::Hash[value.map do |k, v| [Coerce.perform(members[0], k), Coerce.perform(members[1], v)] end] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.6.2 | lib/mixture/coerce/hash.rb |
mixture-0.6.1 | lib/mixture/coerce/hash.rb |
mixture-0.6.0 | lib/mixture/coerce/hash.rb |