Class: Dry::Schema::Macros::Each Private
- Defined in:
- lib/dry/schema/macros/each.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Macro used to specify predicates for each element of an array
Instance Attribute Summary
Attributes inherited from DSL
Instance Method Summary collapse
- #to_ast ⇒ Object (also: #ast) private
- #value(*args, **opts) ⇒ Object private
Methods inherited from DSL
#array, #each, #filled, #hash, #schema, #type
Methods inherited from Core
Instance Method Details
#to_ast ⇒ Object Also known as: ast
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/dry/schema/macros/each.rb', line 25 def to_ast(*) [:each, trace.to_ast] end |
#value(*args, **opts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 22 |
# File 'lib/dry/schema/macros/each.rb', line 14 def value(*args, **opts) extract_type_spec(*args, set_type: false) do |*predicates, type_spec:| if type_spec && !type_spec.is_a?(Dry::Types::Type) type(schema_dsl.array[type_spec]) end super(*predicates, type_spec: type_spec, **opts) end end |