diff options
author | Alexey Vakhov <vakhov@gmail.com> | 2012-03-24 15:14:37 +0400 |
---|---|---|
committer | Alexey Vakhov <vakhov@gmail.com> | 2012-03-24 17:10:15 +0400 |
commit | 6880489e257d937cd8ca5dd105485444fb48b7cc (patch) | |
tree | 2f255ded01853e32d0e106b5784484f6fa03a4b4 /actionpack/lib/action_controller/caching/actions.rb | |
parent | 014498e1d74decd57d44d45c187fa4f4b968b811 (diff) | |
download | rails-6880489e257d937cd8ca5dd105485444fb48b7cc.tar.gz rails-6880489e257d937cd8ca5dd105485444fb48b7cc.tar.bz2 rails-6880489e257d937cd8ca5dd105485444fb48b7cc.zip |
ActionController caching small String#split optimization
Diffstat (limited to 'actionpack/lib/action_controller/caching/actions.rb')
-rw-r--r-- | actionpack/lib/action_controller/caching/actions.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index ba96735e56..ceac11bbfb 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -170,14 +170,14 @@ module ActionController #:nodoc: options.reverse_merge!(:format => @extension) if options.is_a?(Hash) end - path = controller.url_for(options).split(%r{://}).last + path = controller.url_for(options).split('://', 2).last @path = normalize!(path) end private def normalize!(path) path << 'index' if path[-1] == ?/ - path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}") + path << ".#{extension}" if extension and !path.split('?', 2).first.ends_with?(".#{extension}") URI.parser.unescape(path) end end |