Class: Dry::Schema::Config

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/dry/schema/config.rb

Overview

Schema definition configuration class

See Also:

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)

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.

Forward to the underlying config object



77
78
79
80
# File 'lib/dry/schema/config.rb', line 77

def method_missing(meth, *args, &block)
  super unless config.respond_to?(meth)
  config.public_send(meth, *args)
end

Instance Method Details

#inspectObject

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.



68
69
70
# File 'lib/dry/schema/config.rb', line 68

def inspect
  "#<#{self.class} #{to_h.map { |k, v| ["#{k}=", v.inspect] }.map(&:join).join(" ")}>"
end

#messagesDry::Configurable::Config

Return configuration for message backend

Returns:

  • (Dry::Configurable::Config)


45
46
47
48
49
50
51
# File 'lib/dry/schema/config.rb', line 45

setting :messages do
  setting :backend, default: :yaml
  setting :namespace
  setting :load_paths, default: Set[DEFAULT_MESSAGES_PATH], constructor: :dup.to_proc
  setting :top_namespace, default: DEFAULT_MESSAGES_ROOT
  setting :default_locale
end

#predicatesSchema::PredicateRegistry

Return configured predicate registry



25
26
27
# File 'lib/dry/schema/config.rb', line 25

setting :predicates, default: PredicateRegistry.new, constructor: -> predicates {
  predicates.is_a?(PredicateRegistry) ? predicates : PredicateRegistry.new(predicates)
}

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

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.

Returns:

  • (Boolean)


63
64
65
# File 'lib/dry/schema/config.rb', line 63

def respond_to_missing?(meth, include_private = false)
  super || config.respond_to?(meth, include_private)
end

#typesHash

Return configured container with extra types

Returns:

  • (Hash)


36
# File 'lib/dry/schema/config.rb', line 36

setting :types, default: Dry::Types

#validate_keysBoolean

On/off switch for key validator

Returns:

  • (Boolean)


60
# File 'lib/dry/schema/config.rb', line 60

setting :validate_keys, default: false