Sha256: fd38bea24950f29bf23dd8e4e7ddfabdef7d012e08b8c7b8fd7e16b7eb508d2d
Contents?: true
Size: 826 Bytes
Versions: 9
Compression:
Stored size: 826 Bytes
Contents
# frozen_string_literal: true module Dry module Schema module Macros # Macro used to specify predicates for each element of an array # # @api private class Each < DSL # @api private def value(*args, **opts, &block) extract_type_spec(args, set_type: false) do |*predicates, type_spec:, type_rule:| if type_spec && !type_spec.is_a?(Dry::Types::Type) type(schema_dsl.array[type_spec]) end append_macro(Macros::Value) do |macro| macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block) end end end # @api private def to_ast(*) [:each, trace.to_ast] end alias_method :ast, :to_ast end end end end
Version data entries
9 entries across 9 versions & 1 rubygems