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.
26 27 28 29 30 |
# File 'lib/client_side_validations/middleware.rb', line 26 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.
24 25 26 |
# File 'lib/client_side_validations/middleware.rb', line 24 def body @body end |
#request ⇒ Object
Returns the value of attribute request.
24 25 26 |
# File 'lib/client_side_validations/middleware.rb', line 24 def request @request end |
#status ⇒ Object
Returns the value of attribute status.
24 25 26 |
# File 'lib/client_side_validations/middleware.rb', line 24 def status @status end |
Instance Method Details
#content_type ⇒ Object
36 37 38 |
# File 'lib/client_side_validations/middleware.rb', line 36 def content_type 'application/json' end |
#response ⇒ Object
32 33 34 |
# File 'lib/client_side_validations/middleware.rb', line 32 def response [status, {'Content-Type' => content_type, 'Content-Length' => body.length.to_s}, [body]] end |