Given a route

  map.person '/people/:id'

If the user calls person_url(@person), we can simply return a string like "/people/#{@person.to_param}" rather than triggering the expensive logic in url_for.

Methods
Public Instance methods
generation_code()
     # File actionpack/lib/action_controller/routing/optimisations.rb, line 78
 78:         def generation_code
 79:           elements = []
 80:           idx = 0
 81: 
 82:           if kind == :url
 83:             elements << '#{request.protocol}'
 84:             elements << '#{request.host_with_port}'
 85:           end
 86: 
 87:           elements << '#{ActionController::Base.relative_url_root if ActionController::Base.relative_url_root}'
 88: 
 89:           # The last entry in <tt>route.segments</tt> appears to *always* be a
 90:           # 'divider segment' for '/' but we have assertions to ensure that
 91:           # we don't include the trailing slashes, so skip them.
 92:           (route.segments.size == 1 ? route.segments : route.segments[0..-2]).each do |segment|
 93:             if segment.is_a?(DynamicSegment)
 94:               elements << segment.interpolation_chunk("args[#{idx}].to_param")
 95:               idx += 1
 96:             else
 97:               elements << segment.interpolation_chunk
 98:             end
 99:           end
100:           %("#{elements * ''}")
101:         end
guard_conditions()
    # File actionpack/lib/action_controller/routing/optimisations.rb, line 67
67:         def guard_conditions
68:           number_of_arguments = route.required_segment_keys.size
69:           # if they're using foo_url(:id=>2) it's one
70:           # argument, but we don't want to generate /foos/id2
71:           if number_of_arguments == 1
72:             ["args.size == 1", "!args.first.is_a?(Hash)"]
73:           else
74:             ["args.size == #{number_of_arguments}"]
75:           end
76:         end