Class: Rack::App::Middlewares::Params::Validator
- Inherits:
-
Object
- Object
- Rack::App::Middlewares::Params::Validator
- Defined in:
- lib/rack/app/middlewares/params/validator.rb
Constant Summary collapse
- ValidateError =
Class.new(ArgumentError)
Instance Method Summary collapse
-
#call(env) ⇒ Object
> 422 required field missing | “422 Unprocessable Entity”.
-
#initialize(app, descriptor) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
#initialize(app, descriptor) ⇒ Validator
Returns a new instance of Validator.
4 5 6 7 |
# File 'lib/rack/app/middlewares/params/validator.rb', line 4 def initialize(app, descriptor) @descriptor = descriptor @app = app end |
Instance Method Details
#call(env) ⇒ Object
> 422 required field missing | “422 Unprocessable Entity”
10 11 12 13 14 15 |
# File 'lib/rack/app/middlewares/params/validator.rb', line 10 def call(env) validate(env) @app.call(env) rescue ValidateError => ex unprocessable_response(ex) end |