lib/dry/schema/key_coercer.rb in dry-schema-0.1.0 vs lib/dry/schema/key_coercer.rb in dry-schema-0.1.1

- old
+ new

@@ -1,14 +1,16 @@ require 'dry/core/cache' +require 'dry/equalizer' module Dry module Schema # Coerces keys in a hash using provided coercer function # # @api private class KeyCoercer extend Dry::Core::Cache + include ::Dry::Equalizer(:key_map, :coercer) TO_SYM = :to_sym.to_proc.freeze attr_reader :key_map, :coercer @@ -24,10 +26,10 @@ # @api private def initialize(key_map, &coercer) @key_map = key_map.coercible(&coercer) end - + # @api private def call(source) key_map.write(Hash(source)) end alias_method :[], :call