Sha256: 649d26997486efe368570bd6195cba5f9568a204e649300622e6ed91b9968e4e

Contents?: true

Size: 536 Bytes

Versions: 29

Compression:

Stored size: 536 Bytes

Contents

require 'rack/insight/logging'

module Rack::Insight
  class PathFilter
    include Rack::Insight::Logging
    def initialize(app)
      @app = app
    end

    def call(env)
      filters = env['rack-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']}"} if verbose(:debug)
      return @app.call(env)
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
rack-insight-0.6.4 lib/rack/insight/path-filter.rb
rack-insight-0.6.3 lib/rack/insight/path-filter.rb
rack-insight-0.6.2 lib/rack/insight/path-filter.rb
rack-insight-0.5.30 lib/rack/insight/path-filter.rb
rack-insight-0.5.29 lib/rack/insight/path-filter.rb
rack-insight-0.5.28 lib/rack/insight/path-filter.rb
rack-insight-0.5.27 lib/rack/insight/path-filter.rb
rack-insight-0.5.26 lib/rack/insight/path-filter.rb
rack-insight-0.5.25 lib/rack/insight/path-filter.rb
rack-insight-0.5.24 lib/rack/insight/path-filter.rb
rack-insight-0.5.23 lib/rack/insight/path-filter.rb
rack-insight-0.5.22 lib/rack/insight/path-filter.rb
rack-insight-0.5.21 lib/rack/insight/path-filter.rb
rack-insight-0.5.20 lib/rack/insight/path-filter.rb
rack-insight-0.5.19 lib/rack/insight/path-filter.rb
rack-insight-0.5.18 lib/rack/insight/path-filter.rb
rack-insight-0.5.17 lib/rack/insight/path-filter.rb
rack-insight-0.5.16 lib/rack/insight/path-filter.rb
rack-insight-0.5.15 lib/rack/insight/path-filter.rb
rack-insight-0.5.14 lib/rack/insight/path-filter.rb