17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/rack/mount/mappers/merb.rb', line 17
def to_route
raise Error, 'The route has already been committed.' if @route
controller = @params[:controller]
if prefixes = @options[:controller_prefix]
controller ||= ':controller'
prefixes.reverse_each do |prefix|
break if controller =~ %r{^/(.*)} && controller = $1
controller = "#{prefix}/#{controller}"
end
end
@params.merge!(:controller => controller.to_s.gsub(%r{^/}, '')) if controller
identifiers = @identifiers.sort { |(first,_),(sec,_)| first <=> sec || 1 }
Thread.current[:merb_routes] << [
@conditions.dup,
@params,
@blocks,
{ :defaults => @defaults.dup, :identifiers => identifiers }
]
self
end
|