class FakeRails3Routes::Mapper

Public Class Methods

new(set) click to toggle source
# File lib/fake_rails3_routes/mapper.rb, line 6
def initialize(set)
  @set = set
  @scope = { :path_names => { :new => 'new', :edit => 'edit' } }
end
normalize_name(name) click to toggle source
# File lib/fake_rails3_routes/mapper.rb, line 20
def self.normalize_name(name)
  normalize_path(name)[1..-1].gsub("/", "_")
end
normalize_path(path) click to toggle source

Invokes Rack::Mount::Utils.normalize path and ensure that (:locale) becomes (/:locale) instead of /(:locale). Except for root cases, where the latter is the correct one.

# File lib/fake_rails3_routes/mapper.rb, line 14
def self.normalize_path(path)
  path = Journey::Router::Utils.normalize_path(path)
  path.gsub!(%r{/(\(+)/?}, '\1/') unless path =~ %r{^/\(+[^)]+\)$}
  path
end