Class: RackStep::Controller
- Inherits:
-
Object
- Object
- RackStep::Controller
- Defined in:
- lib/controller.rb
Direct Known Subclasses
Defined Under Namespace
Modules: BasicHttpAuthentication, ErbRendering, HtmlRendering
Instance Attribute Summary collapse
-
#request ⇒ Object
The request will be injected here.
-
#response ⇒ Object
The Rack::Response object that will be delivered to the user.
-
#settings ⇒ Object
The ‘global’ app settings will be injected here.
Instance Method Summary collapse
-
#after ⇒ Object
RackStep will always execute this method after processing the request of to the specified method.
-
#before ⇒ Object
RackStep will always execute this method before delegating the request processing to the specified method.
-
#initialize ⇒ Controller
constructor
A new instance of Controller.
Constructor Details
#initialize ⇒ Controller
Returns a new instance of Controller.
19 20 21 22 23 24 |
# File 'lib/controller.rb', line 19 def initialize @response = RackStep::Response.new @response.body = '' @response.content_type = 'application/json' @response.status = 200 end |
Instance Attribute Details
#request ⇒ Object
The request will be injected here.
9 10 11 |
# File 'lib/controller.rb', line 9 def request @request end |
#response ⇒ Object
The Rack::Response object that will be delivered to the user.
12 13 14 |
# File 'lib/controller.rb', line 12 def response @response end |
#settings ⇒ Object
The ‘global’ app settings will be injected here. This may contain references to things that should be initialize only once during the app start (eg: database connection).
17 18 19 |
# File 'lib/controller.rb', line 17 def settings @settings end |
Instance Method Details
#after ⇒ Object
RackStep will always execute this method after processing the request of to the specified method. The user may overwrite this method. This can be used to check for logging or any piece of code that must be executed after every request for this controller.
37 38 |
# File 'lib/controller.rb', line 37 def after end |
#before ⇒ Object
RackStep will always execute this method before delegating the request processing to the specified method. The user may overwrite this method. This can be used to check for access authorization or any piece of code that must be executed before every request for this controller.
30 31 |
# File 'lib/controller.rb', line 30 def before end |