Class: Cuprum::Collections::Basic::Commands::ValidateOne
- Inherits:
-
Cuprum::Collections::Basic::Command
- Object
- Cuprum::Command
- CollectionCommand
- Cuprum::Collections::Basic::Command
- Cuprum::Collections::Basic::Commands::ValidateOne
- Defined in:
- lib/cuprum/collections/basic/commands/validate_one.rb
Overview
Command for validating a collection entity.
Instance Attribute Summary
Attributes inherited from CollectionCommand
Instance Method Summary collapse
-
#call(entity:, contract: nil) ⇒ Cuprum::Result<Hash>
Validates the entity against the given or default contract.
Methods inherited from Cuprum::Collections::Basic::Command
Methods inherited from CollectionCommand
#initialize, #name, #primary_key_name, #primary_key_type, #query, #singular_name
Constructor Details
This class inherits a constructor from Cuprum::Collections::CollectionCommand
Instance Method Details
#call(entity:, contract: nil) ⇒ Cuprum::Result<Hash>
Validates the entity against the given or default contract.
If the entity matches the contract, #call will return a passing result with the entity as the result value. If the entity does not match the contract, #call will return a failing result with a FailedValidation error and the validation errors.
27 |
# File 'lib/cuprum/collections/basic/commands/validate_one.rb', line 27 validate :contract, Stannum::Constraints::Base, optional: true |