Class: ControllerRouter
- Inherits:
-
Router
- Object
- Router
- ControllerRouter
- Defined in:
- lib/shot_mvc/controller_router.rb
Instance Method Summary collapse
-
#initialize(client) ⇒ ControllerRouter
constructor
A new instance of ControllerRouter.
Constructor Details
#initialize(client) ⇒ ControllerRouter
Returns a new instance of ControllerRouter.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/shot_mvc/controller_router.rb', line 13 def initialize(client) super(client) client.on 'call_controller_action' do |data| controller = data['controller'] if controller.include? 'GemRoot' then controller['GemRoot'] = gem_root end action = data['action'] data = (data['data'] or nil) controller = @client.get 'controller', controller if controller.view_private.include? action then raise ControllerLoadException.new "#{controller}##{action} is not view accessible." end if data then controller.send(action, data) else controller.send(action) end end end |