Module: Lotus::Action::Rack
- Defined in:
- lib/lotus/action/rack.rb
Overview
Rack integration API
Constant Summary collapse
- SESSION_KEY =
'rack.session'.freeze
- DEFAULT_RESPONSE_CODE =
200
- DEFAULT_RESPONSE_BODY =
[]
Instance Method Summary collapse
-
#body=(body) ⇒ void
protected
Sets the body of the response.
-
#headers ⇒ Hash
protected
Gets the headers from the response.
-
#response ⇒ Array
protected
private
Returns a serialized Rack response (Array), according to the current status code, headers, and body.
-
#status=(status) ⇒ void
protected
Sets the HTTP status code for the response.
Instance Method Details
#body=(body) ⇒ void (protected)
This method returns an undefined value.
Sets the body of the response
52 53 54 55 |
# File 'lib/lotus/action/rack.rb', line 52 def body=(body) body = Array(body) unless body.respond_to?(:each) @_body = body end |
#headers ⇒ Hash (protected)
Gets the headers from the response
75 76 77 |
# File 'lib/lotus/action/rack.rb', line 75 def headers @headers end |
#response ⇒ Array (protected)
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.
Returns a serialized Rack response (Array), according to the current
status code, headers, and body.
92 93 94 |
# File 'lib/lotus/action/rack.rb', line 92 def response [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ] end |
#status=(status) ⇒ void (protected)
This method returns an undefined value.
Sets the HTTP status code for the response
30 31 32 |
# File 'lib/lotus/action/rack.rb', line 30 def status=(status) @_status = status end |