Sha256: b7d8cc9d1ae2a4fdff221e2d17cba40525818aa34fa605643d1f33b9c63da742

Contents?: true

Size: 442 Bytes

Versions: 2

Compression:

Stored size: 442 Bytes

Contents

module Rollerskates
  module Routing
    class Route
      attr_reader :klass_name, :request, :method_name

      def initialize(request, klass_and_method)
        @klass_name, @method_name = klass_and_method
        @request = request
      end

      def klass
        klass_name.constantize
      end

      def dispatch
        response = klass.new(request)
        response.send(method_name)
        response
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rollerskates-0.1.1 lib/rollerskates/routing/route.rb
rollerskates-0.1.0 lib/rollerskates/routing/route.rb