Class: Linearly::Validation Abstract
- Inherits:
-
Object
- Object
- Linearly::Validation
- Defined in:
- lib/linearly/validation.rb
Overview
This class is abstract.
Validation provides a way to check inputs and outputs against a set of per-field expectations.
Defined Under Namespace
Modules: Expectation Classes: Failure, Inputs, Outputs
Instance Method Summary collapse
-
#call(state) ⇒ Statefully::State
private
Call validation with a State.
-
#initialize(source, expectations) ⇒ Validation
constructor
private
Constructor for a Validation.
Constructor Details
#initialize(source, expectations) ⇒ Validation
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.
Constructor for a Linearly::Validation
18 19 20 21 22 23 24 |
# File 'lib/linearly/validation.rb', line 18 def initialize(source, expectations) @source = source @expectations = expectations .map { |key, expectation| [key, Expectation.to_proc(expectation)] } .to_h end |
Instance Method Details
#call(state) ⇒ Statefully::State
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.
Call validation with a State
32 33 34 35 36 |
# File 'lib/linearly/validation.rb', line 32 def call(state) Validator .new(@source, expectations, state) .validate(error_class) end |