class ControllerRouter

Public Class Methods

new(client) click to toggle source
Calls superclass method
# 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

Private Instance Methods

gem_root() click to toggle source
# File lib/shot_mvc/controller_router.rb, line 35
def gem_root
        Gem::Specification.find_by_name('shot_mvc').gem_dir
end