class Grape::Validations::Types::MultipleTypeCoercer
def initialize(types, method = nil)
-
method
(#call, #parse
) -- method by which values should be -
types
(Array
) -- list of allowed types
def initialize(types, method = nil) @method = method.respond_to?(:parse) ? method.method(:parse) : method @type_coercers = types.map do |type| if Types.multiple? type VariantCollectionCoercer.new type, @method else Types.build_coercer type, strict: !@method.nil? end end end