Class: Rack::Utils::UrlStripper

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/utils/url_stripper.rb

Class Method Summary collapse

Class Method Details

.id_patternObject



5
6
7
8
# File 'lib/rack/utils/url_stripper.rb', line 5

def id_pattern
  # A crude attempt at matching a BSON id format (http://bsonspec.org/)
  @id_pattern ||= /[0-9]+[a-zA-Z]+[^\/]*/
end

.id_pattern=(pattern) ⇒ Object



10
11
12
# File 'lib/rack/utils/url_stripper.rb', line 10

def id_pattern=(pattern)
  @id_pattern = pattern
end

.replace_id(url) ⇒ Object



14
15
16
# File 'lib/rack/utils/url_stripper.rb', line 14

def replace_id(url)
  url.gsub(id_pattern, 'ID')
end