aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-27 20:57:26 -0300
committerEmilio Tagua <miloops@gmail.com>2010-09-27 20:57:26 -0300
commit197a995bc548e206bb907c40d75f8ed70fa5a923 (patch)
treecbfccffef28b604f2cf006e008e779189abed66b /actionpack/lib/action_controller
parent8adb24016d76a2257b79f4566de66e1b88e56c71 (diff)
downloadrails-197a995bc548e206bb907c40d75f8ed70fa5a923.tar.gz
rails-197a995bc548e206bb907c40d75f8ed70fa5a923.tar.bz2
rails-197a995bc548e206bb907c40d75f8ed70fa5a923.zip
Move uri parser to AS as URI.parser method to reuse it in AP and ARes.
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb4
-rw-r--r--actionpack/lib/action_controller/caching/pages.rb8
-rw-r--r--actionpack/lib/action_controller/uri_parser.rb9
3 files changed, 2 insertions, 19 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index cd352f69fc..d69d96b974 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -141,8 +141,6 @@ module ActionController #:nodoc:
end
class ActionCachePath
- include UriParser
-
attr_reader :path, :extension
# If +infer_extension+ is true, the cache path extension is looked up from the request's
@@ -163,7 +161,7 @@ module ActionController #:nodoc:
def normalize!(path)
path << 'index' if path[-1] == ?/
path << ".#{extension}" if extension and !path.ends_with?(extension)
- uri_parser.unescape(path)
+ URI.parser.unescape(path)
end
end
end
diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb
index f0e00718ac..df4d500069 100644
--- a/actionpack/lib/action_controller/caching/pages.rb
+++ b/actionpack/lib/action_controller/caching/pages.rb
@@ -57,8 +57,6 @@ module ActionController #:nodoc:
end
module ClassMethods
- include UriParser
-
# Expires the page that was cached with the +path+ as a key. Example:
# expire_page "/lists/show"
def expire_page(path)
@@ -100,7 +98,7 @@ module ActionController #:nodoc:
private
def page_cache_file(path)
- name = (path.empty? || path == "/") ? "/index" : uri_parser.unescape(path.chomp('/'))
+ name = (path.empty? || path == "/") ? "/index" : URI.parser.unescape(path.chomp('/'))
name << page_cache_extension unless (name.split('/').last || name).include? '.'
return name
end
@@ -112,10 +110,6 @@ module ActionController #:nodoc:
def instrument_page_cache(name, path)
ActiveSupport::Notifications.instrument("#{name}.action_controller", :path => path){ yield }
end
-
- def uri_parser
- @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
- end
end
# Expires the page that was cached with the +options+ as a key. Example:
diff --git a/actionpack/lib/action_controller/uri_parser.rb b/actionpack/lib/action_controller/uri_parser.rb
deleted file mode 100644
index 8e2a3f69eb..0000000000
--- a/actionpack/lib/action_controller/uri_parser.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'uri'
-
-module ActionController #:nodoc:
- module UriParser
- def uri_parser
- @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
- end
- end
-end