lib/dry/schema/macros/each.rb in dry-schema-0.4.0 vs lib/dry/schema/macros/each.rb in dry-schema-0.5.0
- old
+ new
@@ -8,9 +8,18 @@
# Macro used to specify predicates for each element of an array
#
# @api public
class Each < DSL
# @api private
+ def value(*args, **opts)
+ extract_type_spec(*args, set_type: false) do |*predicates, type_spec:|
+ type(schema_dsl.array[type_spec]) if type_spec
+
+ super(*predicates, type_spec: type_spec, **opts)
+ end
+ end
+
+ # @api private
def to_ast(*)
[:each, trace.to_ast]
end
alias_method :ast, :to_ast
end