Module: Dry::Validation
- Extended by:
- Core::Extensions, Macros::Registrar
- Includes:
- Core::Constants
- Defined in:
- lib/dry/validation.rb,
lib/dry/validation/rule.rb,
lib/dry/validation/macro.rb,
lib/dry/validation/config.rb,
lib/dry/validation/macros.rb,
lib/dry/validation/result.rb,
lib/dry/validation/values.rb,
lib/dry/validation/message.rb,
lib/dry/validation/version.rb,
lib/dry/validation/contract.rb,
lib/dry/validation/failures.rb,
lib/dry/validation/function.rb,
lib/dry/validation/constants.rb,
lib/dry/validation/evaluator.rb,
lib/dry/validation/message_set.rb,
lib/dry/validation/extensions/hints.rb,
lib/dry/validation/extensions/monads.rb,
lib/dry/validation/messages/resolver.rb,
lib/dry/validation/contract/class_interface.rb,
lib/dry/validation/extensions/predicates_as_macros.rb
Overview
Main library namespace
Defined Under Namespace
Modules: Hints, Macros, Messages Classes: Config, Contract, Evaluator, Failures, Function, Macro, Message, MessageSet, PredicateRegistry, Result, Rule, Values
Constant Summary collapse
- VERSION =
'1.4.1'
- DOT =
'.'
- ROOT_PATH =
Root path is used for base errors in hash representation of error messages
[nil].freeze
- DEFAULT_ERRORS_NAMESPACE =
Path to the default errors locale file
'dry_validation'
- DEFAULT_ERRORS_PATH =
Path to the default errors locale file
Pathname(__FILE__).join('../../../../config/errors.yml').realpath.freeze
- BLOCK_OPTIONS_MAPPINGS =
Mapping for block kwarg options used by block_options
Hash.new { |_, key| key }.update(context: :_context).freeze
- InvalidKeysError =
Error raised when ‘rule` specifies one or more keys that the schema doesn’t specify
Class.new(StandardError)
- MissingMessageError =
Error raised when a localized message was not found
Class.new(StandardError)
- DuplicateSchemaError =
Error raised when trying to define a schema in a contract class that already has a schema
Class.new(StandardError)
- SchemaMissingError =
Error raised during initialization of a contract that has no schema defined
Class.new(StandardError) do # @api private def initialize(klass) super("#{klass} cannot be instantiated without a schema defined") end end
Class Method Summary collapse
-
.Contract(options = EMPTY_HASH, &block) ⇒ Contract
Define a contract and build its instance.
-
.macros ⇒ Object
private
This is needed by Macros::Registrar.
Methods included from Macros::Registrar
Class Method Details
.Contract(options = EMPTY_HASH, &block) ⇒ Contract
Define a contract and build its instance
rubocop:disable Naming/MethodName
50 51 52 |
# File 'lib/dry/validation.rb', line 50 def self.Contract( = EMPTY_HASH, &block) Contract.build(, &block) end |
.macros ⇒ Object
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.
This is needed by Macros::Registrar
58 59 60 |
# File 'lib/dry/validation.rb', line 58 def self.macros Macros end |