Sha256: 3c6e05dc29e626c608fb5efd3732a69e30b81a8d7c0dbc1c59000125455bd26d
Contents?: true
Size: 500 Bytes
Versions: 2
Compression:
Stored size: 500 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mixture-0.7.1 | lib/mixture/coerce/hash.rb |
mixture-0.7.0 | lib/mixture/coerce/hash.rb |