Module: UserPattern::PathNormalizer
- Defined in:
- lib/userpattern/path_normalizer.rb
Overview
Normalizes request paths so that URLs differing only by dynamic segments (numeric IDs, UUIDs) are aggregated into a single endpoint pattern. Also redacts identifiable values from query strings.
Constant Summary collapse
- NUMERIC_ID =
/\A\d+\z/- UUID =
/\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i- HEX_TOKEN =
/\A[0-9a-f]{16,}\z/i- ID_PLACEHOLDER =
':id'- REDACTED_VALUE =
':xxx'
Class Method Summary collapse
Class Method Details
.normalize(path) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/userpattern/path_normalizer.rb', line 16 def normalize(path) uri_path, query = path.split('?', 2) normalized = normalize_path(uri_path) normalized = "#{normalized}?#{normalize_query(query)}" if query normalized end |