Sha256: 4125427f29b50e6a787c88c03bb2e5b45bbf15bb9982ccc82a3698d0ffe7db21

Contents?: true

Size: 591 Bytes

Versions: 4

Compression:

Stored size: 591 Bytes

Contents

require 'rack'

module RouteDog
  module Middleware
    class RouteDog

      include ::RouteDog

      def initialize(app)
        load_watched_routes
      end

      def request_path
        @env['PATH_INFO']
      end

      def request_method
        @env['REQUEST_METHOD'].downcase.to_sym
      end

      def identify_controller
        identify_path[:controller]
      end

      def identify_action
        identify_path[:action]
      end

      def identify_path
        Rails.application.routes.recognize_path(request_path, :method => request_method)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
route_dog-2.4.2 lib/route_dog/middleware/route_dog.rb
route_dog-2.3.1 lib/route_dog/middleware/route_dog.rb
route_dog-2.3.0 lib/route_dog/middleware/route_dog.rb
route_dog-2.2.0 lib/route_dog/middleware/route_dog.rb