135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
# File 'lib/rack/reqorder/route_recognizers.rb', line 135
def sinatra_recognize_path(path_uri:, rack_app:, options: {})
path_uri = '/' if path_uri.blank?
rack_app.routes[options[:method].to_s.upcase].each do |r|
if r.first =~ path_uri
return r.first.to_s.
gsub('([^\\/?#]+)', ":#{r[1].first}").
gsub('\\z)','').gsub('(?-mix:\\A', '').
gsub('\\','')
end
end
if path_uri.end_with?('.js')
return '/js_asset'
elsif path_uri.end_with?('.css')
return '/css_asset'
elsif path_uri.end_with?('.png', 'jpg')
return '/css_asset'
else
return '/unknown' end
end
|