module Dry::Validation
Main library namespace
@api public
Constants
- BLOCK_OPTIONS_MAPPINGS
-
Mapping for block kwarg options used by block_options
@see Rule#block_options
- DEFAULT_ERRORS_NAMESPACE
-
Path to the default errors locale file
- DEFAULT_ERRORS_PATH
-
Path to the default errors locale file
- DOT
- DuplicateSchemaError
-
Error raised when trying to define a schema in a contract class that already has a schema
- InvalidKeysError
-
Error raised when ‘rule` specifies one or more keys that the schema doesn’t specify
- MissingMessageError
-
Error raised when a localized message was not found
- ROOT_PATH
-
Root path is used for base errors in hash representation of error messages
- SchemaMissingError
-
Error raised during initialization of a contract that has no schema defined
- VERSION
Public Class Methods
Source
# File lib/dry/validation.rb, line 67 def self.Contract(options = EMPTY_HASH, &) Contract.build(options, &) end
Define a contract and build its instance
@example
my_contract = Dry::Validation.Contract do params do required(:name).filled(:string) end end my_contract.call(name: "Jane")
@param [Hash] options Contract
options
@see Contract
@return [Contract]
@api public
Source
# File lib/dry/validation.rb, line 20 def self.loader @loader ||= Zeitwerk::Loader.new.tap do |loader| root = File.expand_path("..", __dir__) loader.tag = "dry-validation" loader.inflector = Zeitwerk::GemInflector.new("#{root}/dry-validation.rb") loader.push_dir(root) loader.ignore( "#{root}/dry-validation.rb", "#{root}/dry/validation/schema_ext.rb", "#{root}/dry/validation/{constants,errors,version}.rb", "#{root}/dry/validation/extensions" ) loader.inflector.inflect("dsl" => "DSL") end end
Source
# File lib/dry/validation.rb, line 74 def self.macros Macros end
This is needed by Macros::Registrar
@api private