diff options
author | Tekin Suleyman <tekin@tekin.co.uk> | 2009-03-10 15:26:59 +0000 |
---|---|---|
committer | Tekin Suleyman <tekin@tekin.co.uk> | 2009-03-10 15:26:59 +0000 |
commit | f1e903aa92f9e4913f3a34135e2dee43bd0cb0c1 (patch) | |
tree | bc3ead9f6c1a703649fb06d4c6e83e5e220a8bfe /actionpack/lib/action_controller/routing/segments.rb | |
parent | 7fa0a8d7f38a42d2f41a3f4aefc129d7071b0258 (diff) | |
parent | 5739626031b4d938652e5d5b84b20620dcbf6fde (diff) | |
download | rails-f1e903aa92f9e4913f3a34135e2dee43bd0cb0c1.tar.gz rails-f1e903aa92f9e4913f3a34135e2dee43bd0cb0c1.tar.bz2 rails-f1e903aa92f9e4913f3a34135e2dee43bd0cb0c1.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'actionpack/lib/action_controller/routing/segments.rb')
-rw-r--r-- | actionpack/lib/action_controller/routing/segments.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb index 129e87c139..4f936d51d2 100644 --- a/actionpack/lib/action_controller/routing/segments.rb +++ b/actionpack/lib/action_controller/routing/segments.rb @@ -3,7 +3,11 @@ module ActionController class Segment #:nodoc: RESERVED_PCHAR = ':@&=+$,;' SAFE_PCHAR = "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}" - UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false, 'N').freeze + if RUBY_VERSION >= '1.9' + UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false).freeze + else + UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false, 'N').freeze + end # TODO: Convert :is_optional accessor to read only attr_accessor :is_optional @@ -314,13 +318,17 @@ module ActionController end def regexp_chunk - '(\.[^/?\.]+)?' + '/|(\.[^/?\.]+)?' end def to_s '(.:format)?' end - + + def extract_value + "#{local_name} = options[:#{key}] && options[:#{key}].to_s.downcase" + end + #the value should not include the period (.) def match_extraction(next_capture) %[ |