Class: Insight::PathFilter
- Inherits:
-
Object
- Object
- Insight::PathFilter
- Includes:
- Logging
- Defined in:
- lib/insight/path-filter.rb
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (PathFilter) initialize(app)
constructor
A new instance of PathFilter.
Methods included from Logging
Constructor Details
- (PathFilter) initialize(app)
A new instance of PathFilter
6 7 8 |
# File 'lib/insight/path-filter.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
- (Object) call(env)
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/insight/path-filter.rb', line 10 def call(env) filters = env['insight.path_filters'].map do |string| %r{^#{string}} end unless filter = filters.find{|regex| regex =~ env['PATH_INFO']} return [404, {}, []] end logger.debug{ "Shortcutting collection stack: #{filter} =~ #{env['PATH_INFO']}"} return @app.call(env) end |