class Dry::Schema::Macros::Schema

@api private
Macro used to specify a nested schema

def array?

Other tags:
    Api: - private
def array?
  parent_type.respond_to?(:of)
end

def call(*args, &block)

Other tags:
    Api: - private
def call(*args, &block)
  super(*args, &nil) unless args.empty?
  if block
    schema = define(*args, &block)
    trace << schema.to_rule
  end
  self
end

def define(*args, &block)

Other tags:
    Api: - private
def define(*args, &block)
  definition = schema_dsl.new(&block)
  schema = definition.call
  type_schema =
    if array?
      parent_type.of(definition.type_schema)
    elsif redefined_schema?(args)
      parent_type.schema(definition.types)
    else
      definition.type_schema
    end
  final_type = optional? ? type_schema.optional : type_schema
  type(final_type)
  if schema.filter_rules?
    schema_dsl[name].filter { hash?.then(schema(schema.filter_schema)) }
  end
  schema
end

def optional?

Other tags:
    Api: - private
def optional?
  parent_type.optional?
end

def parent_type

Other tags:
    Api: - private
def parent_type
  schema_dsl.types[name]
end

def redefined_schema?(args)

Other tags:
    Api: - private
def redefined_schema?(args)
  schema? && args.first.is_a?(Processor)
end

def schema?

Other tags:
    Api: - private
def schema?
  parent_type.respond_to?(:schema)
end