Class: Mousevc::Controller
- Inherits:
-
Object
- Object
- Mousevc::Controller
- Defined in:
- lib/mousevc/controller.rb
Overview
Base controller class in Mousevc. Handles communication with the model. Decides which view to output.
Instance Attribute Summary collapse
-
#model ⇒ Mousevc::Model
An instance of the
Mousevc::Model
class. -
#view ⇒ Mousevc::View
readonly
An instance of the
Mousevc::View
class.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Controller
constructor
Creates a new
Mousevc::Controller
instance.
Constructor Details
#initialize(options = {}) ⇒ Controller
Controllers should not be instantiated directly. Pass the name of the controller you wish you instantiate to the router via @router.controller along with a model and action. This allows the router to do the work for you on the next application execution or loop.
Creates a new Mousevc::Controller
instance
40 41 42 43 44 |
# File 'lib/mousevc/controller.rb', line 40 def initialize(={}) @model = [:model] @view = [:view] @router = [:router] end |
Instance Attribute Details
#model ⇒ Mousevc::Model
An instance of the Mousevc::Model
class. This will be an instance of the model class passed to the application during initialization. It is also possible to change this via @router.model
19 20 21 |
# File 'lib/mousevc/controller.rb', line 19 def model @model end |
#view ⇒ Mousevc::View (readonly)
An instance of the Mousevc::View
class
28 29 30 |
# File 'lib/mousevc/controller.rb', line 28 def view @view end |