aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-09-27 15:13:11 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-09-27 16:43:04 -0300
commit2f326b7f27349b933fe617d83b3f80c6573ce5d8 (patch)
treecea35ce13fe257fdad5c642681a2df0e4ffdcac2 /actionpack
parent8be911c698aadd389b1607b4dbcea47001761536 (diff)
downloadrails-2f326b7f27349b933fe617d83b3f80c6573ce5d8.tar.gz
rails-2f326b7f27349b933fe617d83b3f80c6573ce5d8.tar.bz2
rails-2f326b7f27349b933fe617d83b3f80c6573ce5d8.zip
Remove warning "URI.unescape is obsolete" from actionpack.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller.rb1
-rw-r--r--actionpack/lib/action_controller/caching/actions.rb6
-rw-r--r--actionpack/lib/action_controller/caching/pages.rb3
-rw-r--r--actionpack/lib/action_controller/test_case.rb4
-rw-r--r--actionpack/lib/action_controller/uri_parser.rb9
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb6
6 files changed, 16 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb
index e02578eafd..787439db87 100644
--- a/actionpack/lib/action_controller.rb
+++ b/actionpack/lib/action_controller.rb
@@ -8,6 +8,7 @@ module ActionController
autoload :Caching
autoload :Metal
autoload :Middleware
+ autoload :UriParser
autoload_under "metal" do
autoload :Compatibility
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb
index e00f4a7b1d..cd352f69fc 100644
--- a/actionpack/lib/action_controller/caching/actions.rb
+++ b/actionpack/lib/action_controller/caching/actions.rb
@@ -141,6 +141,8 @@ 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,10 +165,6 @@ module ActionController #:nodoc:
path << ".#{extension}" if extension and !path.ends_with?(extension)
uri_parser.unescape(path)
end
-
- def uri_parser
- @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
- end
end
end
end
diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb
index b845c6f6f9..f0e00718ac 100644
--- a/actionpack/lib/action_controller/caching/pages.rb
+++ b/actionpack/lib/action_controller/caching/pages.rb
@@ -1,5 +1,4 @@
require 'fileutils'
-require 'uri'
require 'active_support/core_ext/class/attribute_accessors'
module ActionController #:nodoc:
@@ -58,6 +57,8 @@ 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)
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 676828957a..f1ff57f0cb 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -129,10 +129,6 @@ module ActionController
def self.new_escaped(strings)
new strings.collect {|str| uri_parser.unescape str}
end
-
- def uri_parser
- @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
- end
end
def assign_parameters(routes, controller_path, action, parameters = {})
diff --git a/actionpack/lib/action_controller/uri_parser.rb b/actionpack/lib/action_controller/uri_parser.rb
new file mode 100644
index 0000000000..8e2a3f69eb
--- /dev/null
+++ b/actionpack/lib/action_controller/uri_parser.rb
@@ -0,0 +1,9 @@
+require 'uri'
+
+module ActionController #:nodoc:
+ module UriParser
+ def uri_parser
+ @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
+ end
+ end
+end
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index a203ee5934..4289e78641 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -5,6 +5,8 @@ require 'active_support/core_ext/object/to_query'
module ActionDispatch
module Routing
class RouteSet #:nodoc:
+ include ActionController::UriParser
+
PARAMETERS_KEY = 'action_dispatch.request.path_parameters'
class Dispatcher #:nodoc:
@@ -68,10 +70,6 @@ module ActionDispatch
def split_glob_param!(params)
params[@glob_param] = params[@glob_param].split('/').map { |v| uri_parser.unescape(v) }
end
-
- def uri_parser
- @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
- end
end
# A NamedRouteCollection instance is a collection of named routes, and also