Skip to content
Browse files

ActionController caching small String#split optimization

  • Loading branch information...
1 parent 014498e commit 6880489e257d937cd8ca5dd105485444fb48b7cc @avakhov avakhov committed Mar 24, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_controller/caching/actions.rb
View
4 actionpack/lib/action_controller/caching/actions.rb
@@ -170,14 +170,14 @@ def initialize(controller, options = {}, infer_extension = true)
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

0 comments on commit 6880489

Please sign in to comment.
Something went wrong with that request. Please try again.