Sha256: 005b1bd083adb117d87cdc52f6a49f428f286f1173cc2724341ddf2712e216c8

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

require "mgt/util"
module Mgt
  module Routing
    class Route
      attr_reader :controller_name, :request, :action
      def initialize(request, class_and_method)
        @controller_name, @action = class_and_method
        @request = request
      end

      def controller_class
        controller_name.to_constant
      end

      def dispatch
        controller = controller_class.new(request)
        controller.send(action)
        controller.render(action) unless controller.get_response
        controller.get_response
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mgt-0.1.0 lib/routing/route.rb