Class | Controller |
In: |
src/org/puremvc/ruby/core/controller.rb
|
Parent: | Object |
In PureMVC, the Controller class assumes these responsibilities:
Your application must register any Commands with the Controller.
The simplest way is to subclass Facade, and use its initializeController method to add your registrations.
command_map | [RW] | |
view | [RW] |
This Controller implementation is a Singleton, so you can not call the constructor directly, but instead call the static Singleton Factory method Controller.instance
If a Command has previously been registered to handle a given Notification, then it is executed
Initialize the Singleton Controller instance.
Called Automatically by the construcor.
Note that if you are using a subclass of View in your application, you should also subclass Controller and override the initialize_controller method in the following way:
<tt>
def initialize_controller @view = MyView.instance end
</tt>
Register a particular Command class as the handler for a particular Notification.
If a Command has already been registered to handle Notification‘s with this name, it is no longer user, the new Command is used instead.
The Observer for the new Command is only created if this is the first time a Command has been registered for this Notification name.