0
module ActionController
0
# Much of the slow performance from routes comes from the
0
- # complexity of expiry,
:requirements matching, defaults providing
0
+ # complexity of expiry,
<tt>:requirements</tt> matching, defaults providing
0
# and figuring out which url pattern to use. With named routes
0
# we can avoid the expense of finding the right route. So if
0
# they've provided the right number of arguments, and have no
0
- #
:requirements, we can just build up a string and return it.
0
+ #
<tt>:requirements</tt>, we can just build up a string and return it.
0
# To support building optimisations for other common cases, the
0
# generation code is separated into several classes
0
@@ -41,19 +41,20 @@ module ActionController
0
- # Temporarily disabled
:url optimisation pending proper solution to
0
+ # Temporarily disabled
<tt>:url</tt> optimisation pending proper solution to
0
# Issues around request.host etc.
0
- # map.person '/people/:id'
0
- # If the user calls person_url(@person), we can simply
0
+ # map.person '/people/:id'
0
+ # If the user calls <tt>person_url(@person)</tt>, we can simply
0
# return a string like "/people/#{@person.to_param}"
0
- # rather than triggering the expensive logic in
url_for0
+ # rather than triggering the expensive logic in
+url_for+.0
class PositionalArguments < Optimiser
0
number_of_arguments = route.segment_keys.size
0
@@ -77,7 +78,7 @@ module ActionController
0
elements << '#{request.relative_url_root if request.relative_url_root}'
0
- # The last entry in
route.segments appears to # *always* be a
0
+ # The last entry in
<tt>route.segments</tt> appears to *always* be a
0
# 'divider segment' for '/' but we have assertions to ensure that
0
# we don't include the trailing slashes, so skip them.
0
(route.segments.size == 1 ? route.segments : route.segments[0..-2]).each do |segment|
0
@@ -106,7 +107,7 @@ module ActionController
0
super.insert(-2, '?#{args.last.to_query}')
0
- # To avoid generating
http://localhost/?host=foo.example.com we
0
+ # To avoid generating
"http://localhost/?host=foo.example.com" we
0
# can't use this optimisation on routes without any segments
0
super && route.segment_keys.size > 0
Comments
No one has commented yet.