class Grape::Validations::Types::CustomTypeCollectionCoercer
of the type.
not allow for such a method to be supplied independently
is supplied. As such, CustomTypeCollectionCoercer does
checking for arrays where an independent coercion methodCustomTypeCoercer is already capable of providing type
of coerced values.
coerce and will return an array (or optionally, a set)
except that it expects to receive an array of strings to
This coercer works in the same way as CustomTypeCoercer
that will be supported by this by this coercer.
See {CustomTypeCoercer} for details on types
def call(value)
-
(Array, Set)- the coerced result. May be an +Array+ or a
Parameters:
-
value(Array) -- an array of values to be coerced
def call(value) coerced = value.map do |item| coerced_item = super(item) return coerced_item if coerced_item.is_a?(InvalidValue) coerced_item end @set ? Set.new(coerced) : coerced end
def initialize(type, set = false)
-
set(Boolean) -- -
type(Class, #parse) --
def initialize(type, set = false) super(type) @set = set end