Sha256: ccbfb5a0e8bcf7a5e0b2d35b63389c21fd0cf2a3316c7841bf2e303836cd205a
Contents?: true
Size: 844 Bytes
Versions: 6
Compression:
Stored size: 844 Bytes
Contents
module RouteDog module Middleware class Watcher < RouteDog attr_accessor :watched_routes def initialize(app) @app = app @watched_routes = ::RouteDog.load_watched_routes end def call(env) @env = env status, headers, response = @app.call(env) store_route if status.to_i < 400 [status, headers, response] end private def store_route watched_routes[identify_controller] ||= {} watched_routes[identify_controller][identify_action] ||= [] watched_routes[identify_controller][identify_action] << request_method.to_s watched_routes[identify_controller][identify_action].uniq! ::RouteDog.write_watched_routes(watched_routes) rescue ActionController::RoutingError false end end end end
Version data entries
6 entries across 6 versions & 1 rubygems