lib/dry/schema/macros/dsl.rb
# Specify predicates that should be applied to each element of an array
#
# This is a simpler building block than `array` macro, use it
# when you want to provide `array?` type-check with other rules
# manually.
#
# @example a list of strings
#   required(:tags).value(:array, min_size?: 2).each(:str?)
#
# @example a list of hashes
#   required(:tags).value(:array, min_size?: 2).each(:hash) do
#     required(:name).filled(:string)
#   end
#
# @return [Macros::Core]
#
# @api public
Specify predicates that should be applied to each element of an array
This is a simpler building block than `array` macro, use it
when you want to provide `array?` type-check with other rules
manually.
Specify predicates that should be applied to each element of an array This is a simpler building block than ` array ` macro use it when you want to provide ` array? ` type - check with other rules manually .
def each(*args, &block)
          append_macro(Macros::Each) do |macro|
            macro.value(*args, &block)
          end
        end
def each ( * args , & block ) append_macro ( Macros :: Each ) do | macro | macro . value ( * args , & block ) end end
Specify predicates that should be applied to each element of an array
This is a simpler building block than `array` macro, use it
when you want to provide `array?` type-check with other rules
manually.
Specify predicates that should be applied to each element of an array This is a simpler building block than ` array ` macro use it when you want to provide ` array? ` type - check with other rules manually .
None
Macros::Core
args
<not_specific>
block
<not_specific>
example
a list of strings required(:tags).value(:array, min_size?: 2).each(:str?)
a list of strings required ( : tags ) . value ( : array min_size? : 2 ) . each ( : str? )
example
a list of hashes required(:tags).value(:array, min_size?: 2).each(:hash) do required(:name).filled(:string) end
a list of hashes required ( : tags ) . value ( : array min_size? : 2 ) . each ( : hash ) do required ( : name ) . filled ( : string ) end
api
None