Class: RouteDog::Middleware::Watcher
- Defined in:
- lib/route_dog/middleware/watcher.rb
Instance Attribute Summary collapse
-
#watched_routes ⇒ Object
Returns the value of attribute watched_routes.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Watcher
constructor
A new instance of Watcher.
Methods included from RouteDog
action_string_for_route, config_file, constantize_controller_str, delete_watched_routes_file, load_watched_routes, route_tested?, route_tested_with_requirements?, watched_routes_file, write_watched_routes
Constructor Details
#initialize(app) ⇒ Watcher
Returns a new instance of Watcher.
7 8 9 10 |
# File 'lib/route_dog/middleware/watcher.rb', line 7 def initialize(app) @app = app @watched_routes = ::RouteDog.load_watched_routes end |
Instance Attribute Details
#watched_routes ⇒ Object
Returns the value of attribute watched_routes.
5 6 7 |
# File 'lib/route_dog/middleware/watcher.rb', line 5 def watched_routes @watched_routes end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/route_dog/middleware/watcher.rb', line 12 def call(env) @env = env status, headers, response = @app.call(env) store_route if status.to_i < 400 [status, headers, response] end |