Sha256: 5bbbb3e9d3e38132d0e778b730121b1b8fa979709630be3471f0ff277ed372df

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 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 public
      class Array < DSL
        # @api private
        def value(*args, &block)
          schema_dsl.set_type(name, :array)
          super
        end

        # @api private
        def to_ast(*)
          [:and, [trace.array?.to_ast, [:each, trace.to_ast]]]
        end

        alias_method :ast, :to_ast
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-schema-0.4.0 lib/dry/schema/macros/array.rb
dry-schema-0.3.0 lib/dry/schema/macros/array.rb