Class: OpenapiContracts::Validators::Base
- Inherits:
-
Object
- Object
- OpenapiContracts::Validators::Base
- Includes:
- Helper
- Defined in:
- lib/openapi_contracts/validators/base.rb
Direct Known Subclasses
Documented, Headers, HttpStatus, Parameters, RequestBody, ResponseBody
Instance Method Summary collapse
- #call(errors = []) ⇒ Object
-
#initialize(stack, env) ⇒ Base
constructor
A new instance of Base.
Methods included from Helper
Constructor Details
#initialize(stack, env) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/openapi_contracts/validators/base.rb', line 8 def initialize(stack, env) @stack = stack # next matcher @env = env @errors = [] end |
Instance Method Details
#call(errors = []) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/openapi_contracts/validators/base.rb', line 14 def call(errors = []) validate errors.push(*@errors) # Do not call the next matcher when there is errors on a final matcher return errors if @errors.any? && final? @stack.call(errors) end |