class Dry::Schema::KeyCoercer

Coerces keys in a hash using provided coercer function

@api private

Constants

TO_SYM

Attributes

coercer[R]
key_map[R]

Public Class Methods

new(*args, &coercer) click to toggle source

@api private

Calls superclass method
# File lib/dry/schema/key_coercer.rb, line 20
def self.new(*args, &coercer)
  fetch_or_store(*args, coercer) { super(*args, &coercer) }
end
new(key_map, &coercer) click to toggle source

@api private

# File lib/dry/schema/key_coercer.rb, line 30
def initialize(key_map, &coercer)
  @key_map = key_map.coercible(&coercer)
end
symbolized(*args) click to toggle source

@api private

# File lib/dry/schema/key_coercer.rb, line 25
def self.symbolized(*args)
  new(*args, &TO_SYM)
end

Public Instance Methods

[](result)
Alias for: call
call(result) click to toggle source

@api private

# File lib/dry/schema/key_coercer.rb, line 35
def call(result)
  key_map.write(result.to_h)
end
Also aliased as: []