class Dry::Schema::Macros::DSL

def value(*args, **opts, &block)

Other tags:
    Api: - public

Returns:
  • (Macros::Core) -

Other tags:
    Example: with a block -
    Example: with a predicate with and without arguments -
    Example: with a predicate with arguments -
    Example: with a predicate -

Parameters:
  • predicate_opts (Hash) --
  • predicates (Array) --

Overloads:
  • value(*predicates, **predicate_opts)
def value(*args, **opts, &block)
  if (type_spec_from_opts = opts[:type_spec])
    append_macro(Macros::Value) do |macro|
      macro.call(*args, type_spec: type_spec_from_opts, **opts, &block)
    end
  else
    extract_type_spec(args) do |*predicates, type_spec:, type_rule:|
      append_macro(Macros::Value) do |macro|
        macro.call(*predicates, type_spec: type_spec, type_rule: type_rule, **opts, &block)
      end
    end
  end
end