Class: ClientSideValidations::Middleware::Base
- Inherits:
-
Object
- Object
- ClientSideValidations::Middleware::Base
- Defined in:
- lib/client_side_validations/middleware.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#request ⇒ Object
Returns the value of attribute request.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(env) ⇒ Base
constructor
A new instance of Base.
- #response ⇒ Object
Constructor Details
#initialize(env) ⇒ Base
Returns a new instance of Base.
25 26 27 28 29 |
# File 'lib/client_side_validations/middleware.rb', line 25 def initialize(env) self.body = '' self.status = 200 self.request = ActionDispatch::Request.new(env) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
23 24 25 |
# File 'lib/client_side_validations/middleware.rb', line 23 def body @body end |
#request ⇒ Object
Returns the value of attribute request.
23 24 25 |
# File 'lib/client_side_validations/middleware.rb', line 23 def request @request end |
#status ⇒ Object
Returns the value of attribute status.
23 24 25 |
# File 'lib/client_side_validations/middleware.rb', line 23 def status @status end |
Instance Method Details
#content_type ⇒ Object
35 36 37 |
# File 'lib/client_side_validations/middleware.rb', line 35 def content_type 'application/json' end |
#response ⇒ Object
31 32 33 |
# File 'lib/client_side_validations/middleware.rb', line 31 def response [status, {'Content-Type' => content_type, 'Content-Length' => body.length.to_s}, [body]] end |