<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,16 +4,16 @@ module ActionController
       attr_accessor :separators, :optional_separators
 
       def initialize
-        self.separators = Routing::SEPARATORS
-        self.optional_separators = %w( / )
+        @separators = Routing::SEPARATORS
+        @optional_separators = %w( / )
       end
 
       def separator_pattern(inverted = false)
-        &quot;[#{'^' if inverted}#{Regexp.escape(separators.join)}]&quot;
+        &quot;[#{'^' if inverted}#{Regexp.escape(@separators.join)}]&quot;
       end
 
       def interval_regexp
-        Regexp.new &quot;(.*?)(#{separators.source}|$)&quot;
+        Regexp.new &quot;(.*?)(#{@separators.source}|$)&quot;
       end
 
       def multiline_regexp?(expression)
@@ -54,7 +54,7 @@ module ActionController
           when /\A(#{separator_pattern(:inverted)}+)/ then StaticSegment.new($1)
           when Regexp.new(separator_pattern) then
             returning segment = DividerSegment.new($&amp;) do
-              segment.is_optional = (optional_separators.include? $&amp;)
+              segment.is_optional = (@optional_separators.include? $&amp;)
             end
         end
         [segment, $~.post_match]</diff>
      <filename>actionpack/lib/action_controller/routing/builder.rb</filename>
    </modified>
    <modified>
      <diff>@@ -57,7 +57,7 @@ module ActionController
       # rather than triggering the expensive logic in +url_for+.
       class PositionalArguments &lt; Optimiser
         def guard_condition
-          number_of_arguments = route.segment_keys.size
+          number_of_arguments = @route.segment_keys.size
           # if they're using foo_url(:id=&gt;2) it's one 
           # argument, but we don't want to generate /foos/id2
           if number_of_arguments == 1
@@ -71,7 +71,7 @@ module ActionController
           elements = []
           idx = 0
 
-          if kind == :url
+          if @kind == :url
             elements &lt;&lt; '#{request.protocol}'
             elements &lt;&lt; '#{request.host_with_port}'
           end
@@ -81,7 +81,7 @@ module ActionController
           # The last entry in &lt;tt&gt;route.segments&lt;/tt&gt; appears to *always* be a
           # 'divider segment' for '/' but we have assertions to ensure that
           # we don't include the trailing slashes, so skip them.
-          (route.segments.size == 1 ? route.segments : route.segments[0..-2]).each do |segment|
+          (@route.segments.size == 1 ? @route.segments : @route.segments[0..-2]).each do |segment|
             if segment.is_a?(DynamicSegment)
               elements &lt;&lt; segment.interpolation_chunk(&quot;args[#{idx}].to_param&quot;)
               idx += 1
@@ -98,7 +98,7 @@ module ActionController
       # argument
       class PositionalArgumentsWithAdditionalParams &lt; PositionalArguments
         def guard_condition
-          &quot;(!defined?(default_url_options) || default_url_options.blank?) &amp;&amp; defined?(request) &amp;&amp; request &amp;&amp; args.size == #{route.segment_keys.size + 1} &amp;&amp; !args.last.has_key?(:anchor) &amp;&amp; !args.last.has_key?(:port) &amp;&amp; !args.last.has_key?(:host)&quot;
+          &quot;(!defined?(default_url_options) || default_url_options.blank?) &amp;&amp; defined?(request) &amp;&amp; request &amp;&amp; args.size == #{@route.segment_keys.size + 1} &amp;&amp; !args.last.has_key?(:anchor) &amp;&amp; !args.last.has_key?(:port) &amp;&amp; !args.last.has_key?(:host)&quot;
         end
 
         # This case uses almost the same code as positional arguments, 
@@ -110,7 +110,7 @@ module ActionController
         # To avoid generating &quot;http://localhost/?host=foo.example.com&quot; we
         # can't use this optimisation on routes without any segments
         def applicable?
-          super &amp;&amp; route.segment_keys.size &gt; 0 
+          super &amp;&amp; @route.segment_keys.size &gt; 0 
         end
       end
 </diff>
      <filename>actionpack/lib/action_controller/routing/optimisations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,7 +17,7 @@ module ActionController
       end
 
       def segment_keys
-        segments.collect do |segment|
+        @segments.collect do |segment|
           segment.key if segment.respond_to? :key
         end.compact
       end
@@ -52,7 +52,7 @@ module ActionController
       # Build several lines of code that extract values from the options hash. If any
       # of the values are missing or rejected then a return will be executed.
       def generation_extraction
-        segments.collect do |segment|
+        @segments.collect do |segment|
           segment.extraction_code
         end.compact * &quot;\n&quot;
       end
@@ -60,7 +60,7 @@ module ActionController
       # Produce a condition expression that will check the requirements of this route
       # upon generation.
       def generation_requirements
-        requirement_conditions = requirements.collect do |key, req|
+        requirement_conditions = @requirements.collect do |key, req|
           if req.is_a? Regexp
             value_regexp = Regexp.new &quot;\\A#{req.to_s}\\Z&quot;
             &quot;hash[:#{key}] &amp;&amp; #{value_regexp.inspect} =~ options[:#{key}]&quot;
@@ -72,7 +72,7 @@ module ActionController
       end
 
       def generation_structure
-        segments.last.string_structure segments[0..-2]
+        @segments.last.string_structure @segments[0..-2]
       end
 
       # Write and compile a +recognize+ method for this Route.
@@ -92,14 +92,14 @@ module ActionController
       # recognition, not generation.
       def recognition_conditions
         result = [&quot;(match = #{Regexp.new(recognition_pattern).inspect}.match(path))&quot;]
-        result &lt;&lt; &quot;conditions[:method] === env[:method]&quot; if conditions[:method]
+        result &lt;&lt; &quot;@conditions[:method] === env[:method]&quot; if @conditions[:method]
         result
       end
 
       # Build the regular expression pattern that will match this route.
       def recognition_pattern(wrap = true)
         pattern = ''
-        segments.reverse_each do |segment|
+        @segments.reverse_each do |segment|
           pattern = segment.build_pattern pattern
         end
         wrap ? (&quot;\\A&quot; + pattern + &quot;\\Z&quot;) : pattern
@@ -108,7 +108,7 @@ module ActionController
       # Write the code to extract the parameters from a matched route.
       def recognition_extraction
         next_capture = 1
-        extraction = segments.collect do |segment|
+        extraction = @segments.collect do |segment|
           x = segment.match_extraction(next_capture)
           next_capture += Regexp.new(segment.regexp_chunk).number_of_captures
           x
@@ -176,7 +176,7 @@ module ActionController
       #
       def parameter_shell
         @parameter_shell ||= returning({}) do |shell|
-          requirements.each do |key, requirement|
+          @requirements.each do |key, requirement|
             shell[key] = requirement unless requirement.is_a? Regexp
           end
         end
@@ -187,8 +187,8 @@ module ActionController
       # placed upon them.
       def significant_keys
         @significant_keys ||= returning [] do |sk|
-          segments.each { |segment| sk &lt;&lt; segment.key if segment.respond_to? :key }
-          sk.concat requirements.keys
+          @segments.each { |segment| sk &lt;&lt; segment.key if segment.respond_to? :key }
+          sk.concat @requirements.keys
           sk.uniq!
         end
       end
@@ -197,11 +197,11 @@ module ActionController
       # have defaults, or which are specified by non-regexp requirements.
       def defaults
         @defaults ||= returning({}) do |hash|
-          segments.each do |segment|
+          @segments.each do |segment|
             next unless segment.respond_to? :default
             hash[segment.key] = segment.default unless segment.default.nil?
           end
-          requirements.each do |key,req|
+          @requirements.each do |key,req|
             next if Regexp === req || req.nil?
             hash[key] = req
           end
@@ -221,15 +221,15 @@ module ActionController
 
       def to_s
         @to_s ||= begin
-          segs = segments.inject(&quot;&quot;) { |str,s| str &lt;&lt; s.to_s }
-          &quot;%-6s %-40s %s&quot; % [(conditions[:method] || :any).to_s.upcase, segs, requirements.inspect]
+          segs = @segments.inject(&quot;&quot;) { |str,s| str &lt;&lt; s.to_s }
+          &quot;%-6s %-40s %s&quot; % [(@conditions[:method] || :any).to_s.upcase, segs, @requirements.inspect]
         end
       end
 
     protected
       def requirement_for(key)
-        return requirements[key] if requirements.key? key
-        segments.each do |segment|
+        return @requirements[key] if @requirements.key? key
+        @segments.each do |segment|
           return segment.regexp if segment.respond_to?(:key) &amp;&amp; segment.key == key
         end
         nil</diff>
      <filename>actionpack/lib/action_controller/routing/route.rb</filename>
    </modified>
    <modified>
      <diff>@@ -79,12 +79,12 @@ module ActionController
         end
 
         def add(name, route)
-          routes[name.to_sym] = route
+          @routes[name.to_sym] = route
           define_named_route_methods(name, route)
         end
 
         def get(name)
-          routes[name.to_sym]
+          @routes[name.to_sym]
         end
 
         alias []=   add
@@ -92,20 +92,20 @@ module ActionController
         alias clear clear!
 
         def each
-          routes.each { |name, route| yield name, route }
+          @routes.each { |name, route| yield name, route }
           self
         end
 
         def names
-          routes.keys
+          @routes.keys
         end
 
         def length
-          routes.length
+          @routes.length
         end
 
         def reset!
-          old_routes = routes.dup
+          old_routes = @routes.dup
           clear!
           old_routes.each do |name, route|
             add(name, route)
@@ -144,7 +144,7 @@ module ActionController
               end
               protected :#{selector}
             end_eval
-            helpers &lt;&lt; selector
+            @helpers &lt;&lt; selector
           end
 
           def define_url_helper(route, name, kind, options)
@@ -185,15 +185,15 @@ module ActionController
               end
               protected :#{selector}
             end_eval
-            helpers &lt;&lt; selector
+            @helpers &lt;&lt; selector
           end
       end
 
       attr_accessor :routes, :named_routes, :configuration_file
 
       def initialize
-        self.routes = []
-        self.named_routes = NamedRouteCollection.new
+        @routes = []
+        @named_routes = NamedRouteCollection.new
       end
 
       # Subclasses and plugins may override this method to specify a different
@@ -209,8 +209,8 @@ module ActionController
       end
 
       def clear!
-        routes.clear
-        named_routes.clear
+        @routes.clear
+        @named_routes.clear
         @combined_regexp = nil
         @routes_by_controller = nil
         # This will force routing/recognition_optimization.rb
@@ -220,11 +220,11 @@ module ActionController
 
       def install_helpers(destinations = [ActionController::Base, ActionView::Base], regenerate_code = false)
         Array(destinations).each { |d| d.module_eval { include Helpers } }
-        named_routes.install(destinations, regenerate_code)
+        @named_routes.install(destinations, regenerate_code)
       end
 
       def empty?
-        routes.empty?
+        @routes.empty?
       end
 
       def load!
@@ -238,8 +238,8 @@ module ActionController
       alias reload! load!
 
       def reload
-        if @routes_last_modified &amp;&amp; configuration_file
-          mtime = File.stat(configuration_file).mtime
+        if @routes_last_modified &amp;&amp; @configuration_file
+          mtime = File.stat(@configuration_file).mtime
           # if it hasn't been changed, then just return
           return if mtime == @routes_last_modified
           # if it has changed then record the new time and fall to the load! below
@@ -249,9 +249,9 @@ module ActionController
       end
 
       def load_routes!
-        if configuration_file
-          load configuration_file
-          @routes_last_modified = File.stat(configuration_file).mtime
+        if @configuration_file
+          load @configuration_file
+          @routes_last_modified = File.stat(@configuration_file).mtime
         else
           add_route &quot;:controller/:action/:id&quot;
         end
@@ -259,14 +259,14 @@ module ActionController
 
       def add_route(path, options = {})
         route = builder.build(path, options)
-        routes &lt;&lt; route
+        @routes &lt;&lt; route
         route
       end
 
       def add_named_route(name, path, options = {})
         # TODO - is options EVER used?
         name = options[:name_prefix] + name.to_s if options[:name_prefix]
-        named_routes[name.to_sym] = add_route(path, options)
+        @named_routes[name.to_sym] = add_route(path, options)
       end
 
       def options_as_params(options)
@@ -308,7 +308,7 @@ module ActionController
         named_route_name = options.delete(:use_route)
         generate_all = options.delete(:generate_all)
         if named_route_name
-          named_route = named_routes[named_route_name]
+          named_route = @named_routes[named_route_name]
           options = named_route.parameter_shell.merge(options)
         end
 
@@ -351,7 +351,7 @@ module ActionController
 
           if generate_all
             # Used by caching to expire all paths for a resource
-            return routes.collect do |route|
+            return @routes.collect do |route|
               route.send!(method, options, merged, expire_on)
             end.compact
           end
@@ -410,14 +410,14 @@ module ActionController
       end
 
       def routes_for_controller_and_action(controller, action)
-        selected = routes.select do |route|
+        selected = @routes.select do |route|
           route.matches_controller_and_action? controller, action
         end
-        (selected.length == routes.length) ? routes : selected
+        (selected.length == @routes.length) ? @routes : selected
       end
 
       def routes_for_controller_and_action_and_keys(controller, action, keys)
-        selected = routes.select do |route|
+        selected = @routes.select do |route|
           route.matches_controller_and_action? controller, action
         end
         selected.sort_by do |route|</diff>
      <filename>actionpack/lib/action_controller/routing/route_set.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ module ActionController
       alias_method :optional?, :is_optional
 
       def initialize
-        self.is_optional = false
+        @is_optional = false
       end
 
       def extraction_code
@@ -68,20 +68,20 @@ module ActionController
 
       def initialize(value = nil)
         super()
-        self.value = value
+        @value = value
       end
 
       def interpolation_chunk
-        raw? ? value : super
+        @raw ? @value : super
       end
 
       def regexp_chunk
-        chunk = Regexp.escape(value)
+        chunk = Regexp.escape(@value)
         optional? ? Regexp.optionalize(chunk) : chunk
       end
 
       def build_pattern(pattern)
-        escaped = Regexp.escape(value)
+        escaped = Regexp.escape(@value)
         if optional? &amp;&amp; ! pattern.empty?
           &quot;(?:#{Regexp.optionalize escaped}\\Z|#{escaped}#{Regexp.unoptionalize pattern})&quot;
         elsif optional?
@@ -92,15 +92,15 @@ module ActionController
       end
 
       def to_s
-        value
+        @value
       end
     end
 
     class DividerSegment &lt; StaticSegment #:nodoc:
       def initialize(value = nil)
         super(value)
-        self.raw = true
-        self.is_optional = true
+        @raw = true
+        @is_optional = true
       end
 
       def optionality_implied?
@@ -113,36 +113,36 @@ module ActionController
 
       def initialize(key = nil, options = {})
         super()
-        self.key = key
-        self.default = options[:default] if options.key? :default
-        self.is_optional = true if options[:optional] || options.key?(:default)
+        @key = key
+        @default = options[:default] if options.key? :default
+        @is_optional = true if options[:optional] || options.key?(:default)
       end
 
       def to_s
-        &quot;:#{key}&quot;
+        &quot;:#{@key}&quot;
       end
 
       # The local variable name that the value of this segment will be extracted to.
       def local_name
-        &quot;#{key}_value&quot;
+        &quot;#{@key}_value&quot;
       end
 
       def extract_value
-        &quot;#{local_name} = hash[:#{key}] &amp;&amp; hash[:#{key}].to_param #{&quot;|| #{default.inspect}&quot; if default}&quot;
+        &quot;#{local_name} = hash[:#{@key}] &amp;&amp; hash[:#{@key}].to_param #{&quot;|| #{@default.inspect}&quot; if @default}&quot;
       end
       def value_check
-        if default # Then we know it won't be nil
-          &quot;#{value_regexp.inspect} =~ #{local_name}&quot; if regexp
+        if @default # Then we know it won't be nil
+          &quot;#{value_regexp.inspect} =~ #{local_name}&quot; if @regexp
         elsif optional?
           # If we have a regexp check that the value is not given, or that it matches.
           # If we have no regexp, return nil since we do not require a condition.
-          &quot;#{local_name}.nil? || #{value_regexp.inspect} =~ #{local_name}&quot; if regexp
+          &quot;#{local_name}.nil? || #{value_regexp.inspect} =~ #{local_name}&quot; if @regexp
         else # Then it must be present, and if we have a regexp, it must match too.
-          &quot;#{local_name} #{&quot;&amp;&amp; #{value_regexp.inspect} =~ #{local_name}&quot; if regexp}&quot;
+          &quot;#{local_name} #{&quot;&amp;&amp; #{value_regexp.inspect} =~ #{local_name}&quot; if @regexp}&quot;
         end
       end
       def expiry_statement
-        &quot;expired, hash = true, options if !expired &amp;&amp; expire_on[:#{key}]&quot;
+        &quot;expired, hash = true, options if !expired &amp;&amp; expire_on[:#{@key}]&quot;
       end
 
       def extraction_code
@@ -161,7 +161,7 @@ module ActionController
           # If we should not appear in the url, just write the code for the prior
           # segments. This occurs if our value is the default value, or, if we are
           # optional, if we have nil as our value.
-          &quot;if #{local_name} == #{default.inspect}\n&quot; +
+          &quot;if #{local_name} == #{@default.inspect}\n&quot; +
             continue_string_structure(prior_segments) +
           &quot;\nelse\n&quot; + # Otherwise, write the code up to here
             &quot;#{interpolation_statement(prior_segments)}\nend&quot;
@@ -171,15 +171,15 @@ module ActionController
       end
 
       def value_regexp
-        Regexp.new &quot;\\A#{regexp.to_s}\\Z&quot; if regexp
+        Regexp.new &quot;\\A#{@regexp.to_s}\\Z&quot; if @regexp
       end
 
       def regexp_chunk
-        if regexp 
+        if @regexp 
           if regexp_has_modifiers?
-            &quot;(#{regexp.to_s})&quot;
+            &quot;(#{@regexp.to_s})&quot;
           else
-            &quot;(#{regexp.source})&quot;
+            &quot;(#{@regexp.source})&quot;
           end
         else
           &quot;([^#{Routing::SEPARATORS.join}]+)&quot;
@@ -196,19 +196,19 @@ module ActionController
       def match_extraction(next_capture)
         # All non code-related keys (such as :id, :slug) are URI-unescaped as
         # path parameters.
-        default_value = default ? default.inspect : nil
+        default_value = @default ? @default.inspect : nil
         %[
           value = if (m = match[#{next_capture}])
             URI.unescape(m)
           else
             #{default_value}
           end
-          params[:#{key}] = value if value
+          params[:#{@key}] = value if value
         ]
       end
 
       def optionality_implied?
-        [:action, :id].include? key
+        [:action, :id].include? @key
       end
 
       def regexp_has_modifiers?
@@ -220,7 +220,7 @@ module ActionController
     class ControllerSegment &lt; DynamicSegment #:nodoc:
       def regexp_chunk
         possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name }
-        &quot;(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))&quot;
+        &quot;(?i-:(#{(@regexp || Regexp.union(*possible_names)).source}))&quot;
       end
 
       # Don't URI.escape the controller name since it may contain slashes.
@@ -231,29 +231,31 @@ module ActionController
       # Make sure controller names like Admin/Content are correctly normalized to
       # admin/content
       def extract_value
-        &quot;#{local_name} = (hash[:#{key}] #{&quot;|| #{default.inspect}&quot; if default}).downcase&quot;
+        &quot;#{local_name} = (hash[:#{@key}] #{&quot;|| #{@default.inspect}&quot; if @default}).downcase&quot;
       end
 
       def match_extraction(next_capture)
-        if default
-          &quot;params[:#{key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{default}'&quot;
+        if @default
+          &quot;params[:#{@key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{@default}'&quot;
         else
-          &quot;params[:#{key}] = match[#{next_capture}].downcase if match[#{next_capture}]&quot;
+          &quot;params[:#{@key}] = match[#{next_capture}].downcase if match[#{next_capture}]&quot;
         end
       end
     end
 
     class PathSegment &lt; DynamicSegment #:nodoc:
+      
+      def initialize( *args )
+        super( *args )
+        @default = ''
+      end
+      
       def interpolation_chunk(value_code = &quot;#{local_name}&quot;)
         &quot;\#{#{value_code}}&quot;
       end
 
       def extract_value
-        &quot;#{local_name} = hash[:#{key}] &amp;&amp; Array(hash[:#{key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{&quot;|| #{default.inspect}&quot; if default}&quot;
-      end
-
-      def default
-        ''
+        &quot;#{local_name} = hash[:#{@key}] &amp;&amp; Array(hash[:#{@key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{&quot;|| #{@default.inspect}&quot; if @default}&quot;
       end
 
       def default=(path)
@@ -261,11 +263,11 @@ module ActionController
       end
 
       def match_extraction(next_capture)
-        &quot;params[:#{key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{&quot; || &quot; + default.inspect if default}).split('/'))#{&quot; if match[&quot; + next_capture + &quot;]&quot; if !default}&quot;
+        &quot;params[:#{@key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{&quot; || &quot; + @default.inspect if @default}).split('/'))#{&quot; if match[&quot; + next_capture + &quot;]&quot; if !@default}&quot;
       end
 
       def regexp_chunk
-        regexp || &quot;(.*)&quot;
+        @regexp || &quot;(.*)&quot;
       end
 
       def optionality_implied?</diff>
      <filename>actionpack/lib/action_controller/routing/segments.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5e8a69acdfe96ff1ba445244e9aa05ad4d2e615d</id>
    </parent>
  </parents>
  <author>
    <name>Lourens Naude</name>
    <email>lourens@methodmissing.com</email>
  </author>
  <url>http://github.com/methodmissing/rails/commit/19bb60109f728d1b972077a1a0291d1a27d34d34</url>
  <id>19bb60109f728d1b972077a1a0291d1a27d34d34</id>
  <committed-date>2008-07-10T05:18:29-07:00</committed-date>
  <authored-date>2008-07-10T05:18:29-07:00</authored-date>
  <message>Avoid excessive AST traversal for Routing</message>
  <tree>50802275c10ac7fbdbd3092a5d64c1d0cb77ce29</tree>
  <committer>
    <name>Lourens Naude</name>
    <email>lourens@methodmissing.com</email>
  </committer>
</commit>
