Sha256: d8af7f7472ea2948b58907746317514dd12c6f8e6536d6e58d511096df00562a
Contents?: true
Size: 859 Bytes
Versions: 1
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true require "dry/schema/macros/dsl" 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dry-schema-1.10.3 | lib/dry/schema/macros/each.rb |