module ParamsReady::Marshaller::TupleMarshallers::HashMarshaller

Public Class Methods

canonicalize(definition, hash, context, validator) click to toggle source
# File lib/params_ready/marshaller/tuple_marshallers.rb, line 49
def self.canonicalize(definition, hash, context, validator)
  array = (0...definition.arity).map do |idx|
    Extensions::Hash.indifferent_access(hash, idx, Extensions::Undefined)
  end
  ArrayMarshaller.canonicalize(definition, array, context, validator)
end
do_marshal(fields, _) click to toggle source
# File lib/params_ready/marshaller/tuple_marshallers.rb, line 56
def self.do_marshal(fields, _)
  fields.each_with_index.map do |field, index|
    [index.to_s, field]
  end.to_h
end