Class: WAB::Controller
- Inherits:
-
Object
- Object
- WAB::Controller
- Defined in:
- lib/wab/controller.rb
Overview
A Controller class or a duck-typed alternative should be created and registered with a Shell for any type that implements behavior other than the default REST API processing.
When a request arrives at the Shell, the expected Controller method is identifed and a check is made to verify if the Controller responds to the method. If it does not, then the handle
method is called. Since respond_to
includes only public methods, only those methods made public in a Controller subclass are considered. The candidates for making public are create
, read
, update
, and delete
.
A description of the available methods is included as private methods.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#shell ⇒ Object
:doc: all.
Instance Method Summary collapse
-
#handle(_data) ⇒ Object
Handler for paths that do not match the REST pattern or for unregistered types.
-
#initialize(shell) ⇒ Controller
constructor
Create a instance.
Constructor Details
#initialize(shell) ⇒ Controller
Create a instance.
19 20 21 |
# File 'lib/wab/controller.rb', line 19 def initialize(shell) @shell = shell end |
Instance Attribute Details
#shell ⇒ Object
:doc: all
16 17 18 |
# File 'lib/wab/controller.rb', line 16 def shell @shell end |
Instance Method Details
#handle(_data) ⇒ Object
Handler for paths that do not match the REST pattern or for unregistered types.
Processing result are passed back to the view which forward the result on to the requester. The result, if not nil, should be a Data instance.
- data
-
data to be processed
30 31 32 |
# File 'lib/wab/controller.rb', line 30 def handle(_data) nil end |