0
@@ -8,7 +8,7 @@ module ActionController
0
alias_method :optional?, :is_optional
0
-
self.is_optional = false
0
@@ -68,20 +68,20 @@ module ActionController
0
def initialize(value = nil)
0
def interpolation_chunk
0
- chunk = Regexp.escape(
value)
0
+ chunk = Regexp.escape(
@value)
0
optional? ? Regexp.optionalize(chunk) : chunk
0
def build_pattern(pattern)
0
- escaped = Regexp.escape(
value)
0
+ escaped = Regexp.escape(
@value)
0
if optional? && ! pattern.empty?
0
"(?:#{Regexp.optionalize escaped}\\Z|#{escaped}#{Regexp.unoptionalize pattern})"
0
@@ -92,15 +92,15 @@ module ActionController
0
class DividerSegment < StaticSegment #:nodoc:
0
def initialize(value = nil)
0
- self.is_optional = true
0
def optionality_implied?
0
@@ -113,36 +113,36 @@ module ActionController
0
def initialize(key = nil, options = {})
0
- self.default = options[:default] if options.key? :default
0
- self.is_optional = true if options[:optional] || options.key?(:default)
0
+ @default = options[:default] if options.key? :default
0
+ @is_optional = true if options[:optional] || options.key?(:default)
0
# The local variable name that the value of this segment will be extracted to.
0
- "#{local_name} = hash[:#{
key}] && hash[:#{key}].to_param #{"|| #{default.inspect}" if default}"
0
+ "#{local_name} = hash[:#{
@key}] && hash[:#{@key}].to_param #{"|| #{@default.inspect}" if @default}"
0
- if default # Then we know it won't be nil
0
- "#{value_regexp.inspect} =~ #{local_name}" if regexp
0
+ if @default # Then we know it won't be nil
0
+ "#{value_regexp.inspect} =~ #{local_name}" if @regexp
0
# If we have a regexp check that the value is not given, or that it matches.
0
# If we have no regexp, return nil since we do not require a condition.
0
- "#{local_name}.nil? || #{value_regexp.inspect} =~ #{local_name}" if
regexp
0
+ "#{local_name}.nil? || #{value_regexp.inspect} =~ #{local_name}" if
@regexp
0
else # Then it must be present, and if we have a regexp, it must match too.
0
- "#{local_name} #{"&& #{value_regexp.inspect} =~ #{local_name}" if
regexp}"
0
+ "#{local_name} #{"&& #{value_regexp.inspect} =~ #{local_name}" if
@regexp}"
0
- "expired, hash = true, options if !expired && expire_on[:#{
key}]"
0
+ "expired, hash = true, options if !expired && expire_on[:#{
@key}]"
0
@@ -161,7 +161,7 @@ module ActionController
0
# If we should not appear in the url, just write the code for the prior
0
# segments. This occurs if our value is the default value, or, if we are
0
# optional, if we have nil as our value.
0
- "if #{local_name} == #{
default.inspect}\n" +
0
+ "if #{local_name} == #{
@default.inspect}\n" +
0
continue_string_structure(prior_segments) +
0
"\nelse\n" + # Otherwise, write the code up to here
0
"#{interpolation_statement(prior_segments)}\nend"
0
@@ -171,15 +171,15 @@ module ActionController
0
- Regexp.new "\\A#{
regexp.to_s}\\Z" if regexp
0
+ Regexp.new "\\A#{
@regexp.to_s}\\Z" if @regexp
0
if regexp_has_modifiers?
0
"([^#{Routing::SEPARATORS.join}]+)"
0
@@ -196,19 +196,19 @@ module ActionController
0
def match_extraction(next_capture)
0
# All non code-related keys (such as :id, :slug) are URI-unescaped as
0
- default_value =
default ? default.inspect : nil
0
+ default_value =
@default ? @default.inspect : nil
0
value = if (m = match[#{next_capture}])
0
- params[:#{
key}] = value if value
0
+ params[:#{
@key}] = value if value
0
def optionality_implied?
0
- [:action, :id].include?
key
0
+ [:action, :id].include?
@key
0
def regexp_has_modifiers?
0
@@ -220,7 +220,7 @@ module ActionController
0
class ControllerSegment < DynamicSegment #:nodoc:
0
possible_names = Routing.possible_controllers.collect { |name| Regexp.escape name }
0
- "(?i-:(#{(
regexp || Regexp.union(*possible_names)).source}))"
0
+ "(?i-:(#{(
@regexp || Regexp.union(*possible_names)).source}))"
0
# Don't URI.escape the controller name since it may contain slashes.
0
@@ -231,29 +231,31 @@ module ActionController
0
# Make sure controller names like Admin/Content are correctly normalized to
0
- "#{local_name} = (hash[:#{
key}] #{"|| #{default.inspect}" if default}).downcase"
0
+ "#{local_name} = (hash[:#{
@key}] #{"|| #{@default.inspect}" if @default}).downcase"
0
def match_extraction(next_capture)
0
- "params[:#{key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{default}'"
0
+ "params[:#{@key}] = match[#{next_capture}] ? match[#{next_capture}].downcase : '#{@default}'"
0
- "params[:#{
key}] = match[#{next_capture}].downcase if match[#{next_capture}]"
0
+ "params[:#{
@key}] = match[#{next_capture}].downcase if match[#{next_capture}]"
0
class PathSegment < DynamicSegment #:nodoc:
0
+ def initialize( *args )
0
def interpolation_chunk(value_code = "#{local_name}")
0
- "#{local_name} = hash[:#{key}] && Array(hash[:#{key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{default.inspect}" if default}"
0
+ "#{local_name} = hash[:#{@key}] && Array(hash[:#{@key}]).collect { |path_component| URI.escape(path_component.to_param, ActionController::Routing::Segment::UNSAFE_PCHAR) }.to_param #{"|| #{@default.inspect}" if @default}"
0
@@ -261,11 +263,11 @@ module ActionController
0
def match_extraction(next_capture)
0
- "params[:#{
key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{" || " + default.inspect if default}).split('/'))#{" if match[" + next_capture + "]" if !default}"
0
+ "params[:#{
@key}] = PathSegment::Result.new_escaped((match[#{next_capture}]#{" || " + @default.inspect if @default}).split('/'))#{" if match[" + next_capture + "]" if !@default}"
0
def optionality_implied?