Class: Sinatra::UrlTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/urls.rb

Class Method Summary collapse

Class Method Details

.add(path, scopes = [], options = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/sinatra/urls.rb', line 10

def self.add(path, scopes = [], options = {})
  name = (scopes.join("_") + "_" + path.to_s).gsub(/^_|_$/, "")

  if name =~ /[a-zA-z0-9_\-%]/
    self.urls[name] = ("/" + scopes.join("/") + "/" + path).squeeze("/")
  end
end