# File actionpack/lib/action_controller/routing/builder.rb, line 82def assign_route_options(segments,defaults,requirements)route_requirements={}# Requirements that do not belong to a segmentsegment_named=Proc.newdo|key|segments.detect{|segment|segment.key==keyifsegment.respond_to?(:key)}endrequirements.eachdo|key,requirement|segment=segment_named[key]ifsegmentraiseTypeError,"#{key}: requirements on a path segment must be regular expressions"unlessrequirement.is_a?(Regexp)ifrequirement.source=~%r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}raiseArgumentError,"Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}"endifrequirement.multiline?raiseArgumentError,"Regexp multiline option not allowed in routing requirements: #{requirement.inspect}"endsegment.regexp=requirementelseroute_requirements[key]=requirementendenddefaults.eachdo|key,default|segment=segment_named[key]raiseArgumentError,"#{key}: No matching segment exists; cannot assign default"unlesssegmentsegment.is_optional=truesegment.default=default.to_paramifdefaultendassign_default_route_options(segments)ensure_required_segments(segments)route_requirementsend