class Dry::Schema::Macros::Value
@api public
A macro used for specifying predicates to be applied to values from a hash
def call(*predicates, **opts, &block)
- Api: - private
def call(*predicates, **opts, &block) schema = predicates.detect { |predicate| predicate.is_a?(Processor) } if schema current_type = schema_dsl.types[name] updated_type = if current_type.respond_to?(:of) current_type.of(schema.type_schema) else schema.type_schema end schema_dsl.set_type(name, updated_type) end trace.evaluate(*predicates, **opts) trace.append(new(chain: false).instance_exec(&block)) if block if trace.captures.empty? raise ArgumentError, 'wrong number of arguments (given 0, expected at least 1)' end self end
def method_missing(meth, *args, &block)
- Api: - private
def method_missing(meth, *args, &block) if meth.to_s.end_with?(QUESTION_MARK) trace.__send__(meth, *args, &block) else super end end
def respond_to_missing?(meth, include_private = false)
- Api: - private
def respond_to_missing?(meth, include_private = false) super || meth.to_s.end_with?(QUESTION_MARK) end