Module: Waves::ResponseMixin
- Included in:
- Controllers::Mixin, ResponseProxy, Views::Mixin
- Defined in:
- lib/runtime/response_mixin.rb
Overview
Defines a set of methods that simplify accessing common request and response methods. These include methods not necessarily associated with the Waves::Request and Waves::Response objects, but which may still be useful for constructing a response.
This mixin assumes that a @request@ accessor already exists.
Instance Method Summary collapse
-
#controllers ⇒ Object
Access the primary application’s controllers.
-
#domain ⇒ Object
Access the request domain.
-
#log ⇒ Object
Access the Waves::Logger.
-
#models ⇒ Object
Access the primary application’s models.
-
#not_found ⇒ Object
Raise a “not found” exception.
-
#params ⇒ Object
Access the request parameters.
-
#path ⇒ Object
Access the request path.
-
#redirect(location, status = '302') ⇒ Object
Issue a redirect for the given location.
-
#response ⇒ Object
Access the response.
-
#session ⇒ Object
Access the request session.
-
#url ⇒ Object
Access the request url.
-
#views ⇒ Object
Access the primary application’s views.
Instance Method Details
#controllers ⇒ Object
Access the primary application’s controllers
28 |
# File 'lib/runtime/response_mixin.rb', line 28 def controllers; Waves.application.controllers; end |
#domain ⇒ Object
Access the request domain.
20 |
# File 'lib/runtime/response_mixin.rb', line 20 def domain; request.domain; end |
#log ⇒ Object
Access the Waves::Logger.
32 |
# File 'lib/runtime/response_mixin.rb', line 32 def log; Waves::Logger; end |
#models ⇒ Object
Access the primary application’s models
24 |
# File 'lib/runtime/response_mixin.rb', line 24 def models; Waves.application.models; end |
#not_found ⇒ Object
Raise a “not found” exception.
30 |
# File 'lib/runtime/response_mixin.rb', line 30 def not_found; request.not_found; end |
#params ⇒ Object
Access the request parameters.
12 |
# File 'lib/runtime/response_mixin.rb', line 12 def params; request.params; end |
#path ⇒ Object
Access the request path.
16 |
# File 'lib/runtime/response_mixin.rb', line 16 def path; request.path; end |
#redirect(location, status = '302') ⇒ Object
Issue a redirect for the given location.
22 |
# File 'lib/runtime/response_mixin.rb', line 22 def redirect(location, status = '302'); request.redirect(location, status); end |
#response ⇒ Object
Access the response.
10 |
# File 'lib/runtime/response_mixin.rb', line 10 def response; request.response; end |
#session ⇒ Object
Access the request session.
14 |
# File 'lib/runtime/response_mixin.rb', line 14 def session; request.session; end |
#url ⇒ Object
Access the request url.
18 |
# File 'lib/runtime/response_mixin.rb', line 18 def url; request.url; end |
#views ⇒ Object
Access the primary application’s views
26 |
# File 'lib/runtime/response_mixin.rb', line 26 def views; Waves.application.views; end |