class Rekey::HashOf

Public Class Methods

new(key, schema) click to toggle source
# File lib/rekey/hash_of.rb, line 4
def initialize key, schema
  @key = key
  @schema = schema
end

Public Instance Methods

rekey(obj) click to toggle source
# File lib/rekey/hash_of.rb, line 9
def rekey obj
  obj[@key]
    .map { |key, value| Hash[key, @schema.rekey(value)] }
    .reduce({}, &:merge)
end