Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/vendor/rails/actionpack/lib/action_controller/routing.rb b/vendor/rails/actionpack/lib/action_controller/routing.rb
- index edd4683..3de5a08 100644
- --- a/vendor/rails/actionpack/lib/action_controller/routing.rb
- +++ b/vendor/rails/actionpack/lib/action_controller/routing.rb
- @@ -702,9 +702,11 @@ 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
- + unless @default = options[:default]
- + @default = nil
- + end
- + @is_optional = true if options[:optional] || @default
- end
- def to_s
- @@ -855,19 +857,22 @@ module ActionController
- end
- class RouteBuilder #:nodoc:
- - attr_accessor :separators, :optional_separators
- + attr_accessor :optional_separators
- +
- + SEPARATORS = Routing::SEPARATORS
- + SEPARATOR_PATTERN_AS_STRING = "[#{Regexp.escape(SEPARATORS.join).to_s}]"
- + SEPARATOR_PATTERN_AS_REGEXP = Regexp.new(SEPARATOR_PATTERN_AS_STRING)
- def initialize
- - self.separators = Routing::SEPARATORS
- self.optional_separators = %w( / )
- end
- def separator_pattern(inverted = false)
- - "[#{'^' if inverted}#{Regexp.escape(separators.join)}]"
- + SEPARATOR_PATTERN_AS_STRING
- end
- def interval_regexp
- - Regexp.new "(.*?)(#{separators.source}|$)"
- + Regexp.new "(.*?)(#{SEPARATORS.source}|$)"
- end
- # Accepts a "route path" (a string defining a route), and returns the array
- @@ -902,7 +907,7 @@ module ActionController
- segment.is_optional = true
- end
- when /\A(#{separator_pattern(:inverted)}+)/ then StaticSegment.new($1)
- - when Regexp.new(separator_pattern) then
- + when SEPARATOR_PATTERN_AS_REGEXP then
- returning segment = DividerSegment.new($&) do
- segment.is_optional = (optional_separators.include? $&)
- end
Add Comment
Please, Sign In to add comment