Sha256: 79c76d9a19127afe62091189d441b8e1ba88e2b3615c8d1a3855ddb49c7589b4

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

# frozen_string_literal: true

require "tora/controller"

module Tora
    class Application
        # this function will compose a magical name for the class of the component ant will try to instantiate
        # the object that has that name and returns which action it should respond to. this is obtained via the
        # part of the route we obtain
        def get_controller_and_action(env)
            _, controller_name, action, after = env["PATH_INFO"].split("/", 4)
            controller_name = controller_name.capitalize + "Controller"
            
            [Object.const_get(controller_name), action]
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tora-0.0.5 lib/tora/routing.rb