Module: Rack::Insight::PathMatchFilters

Included in:
EnableButton, Toolbar
Defined in:
lib/rack/insight/path_match_filters.rb

Instance Method Summary collapse

Instance Method Details

#match_path_filters?(path_filters, path) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/rack/insight/path_match_filters.rb', line 4

def match_path_filters?(path_filters, path)
  to_regex(path_filters).find { |filter| path =~ filter }
end

#to_regex(filters) ⇒ Object



8
9
10
# File 'lib/rack/insight/path_match_filters.rb', line 8

def to_regex(filters)
  (filters || []).map { |str| %r(^#{str}) }
end