class Dry::Schema::Info::SchemaCompiler

Public Instance Methods

visit_not(_node, opts = {}) click to toggle source
# File lib/active_dry_form/schema_compiler_patch.rb, line 9
def visit_not(_node, opts = {})
  key = opts[:key]
  keys[key][:nullable] = true
end
visit_predicate(node, opts = {}) click to toggle source
# File lib/active_dry_form/schema_compiler_patch.rb, line 14
def visit_predicate(node, opts = {})
  name, rest = node

  key = opts[:key]

  if name.equal?(:key?)
    keys[rest[0][1]] = { required: opts.fetch(:required, true) }
  elsif name.equal?(:array?)
    keys[key][:array] = true
  else
    type = PREDICATE_TO_TYPE[name]
    keys[key][:type] = type if type
  end
end