diff options
author | kennyj <kennyj@gmail.com> | 2012-01-19 19:38:23 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-01-19 20:27:16 +0900 |
commit | d8b06dc5c250f80687f3e9d5de77b6cdf106c8f0 (patch) | |
tree | 6cc58bd5657ea5413d51f59c4893252c81bf0130 | |
parent | 04d6ebb467a449a5b56151de5fb13c41318d217a (diff) | |
download | rails-d8b06dc5c250f80687f3e9d5de77b6cdf106c8f0.tar.gz rails-d8b06dc5c250f80687f3e9d5de77b6cdf106c8f0.tar.bz2 rails-d8b06dc5c250f80687f3e9d5de77b6cdf106c8f0.zip |
Convert URI.parser.parse to URI.parse, and remove ruby 1.8.x code.
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 4 | ||||
-rw-r--r-- | activeresource/lib/active_resource/connection.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/uri.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/uri_ext_test.rb | 8 |
4 files changed, 7 insertions, 11 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 548990cb70..ed872c0883 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -939,12 +939,12 @@ module ActiveResource # Accepts a URI and creates the site URI from that. def create_site_uri_from(site) - site.is_a?(URI) ? site.dup : URI.parser.parse(site) + site.is_a?(URI) ? site.dup : URI.parse(site) end # Accepts a URI and creates the proxy URI from that. def create_proxy_uri_from(proxy) - proxy.is_a?(URI) ? proxy.dup : URI.parser.parse(proxy) + proxy.is_a?(URI) ? proxy.dup : URI.parse(proxy) end # contains a set of the current prefix parameters. diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 94839c8c25..2a034f9269 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -39,14 +39,14 @@ module ActiveResource # Set URI for remote service. def site=(site) - @site = site.is_a?(URI) ? site : URI.parser.parse(site) + @site = site.is_a?(URI) ? site : URI.parse(site) @user = URI.parser.unescape(@site.user) if @site.user @password = URI.parser.unescape(@site.password) if @site.password end # Set the proxy for remote service. def proxy=(proxy) - @proxy = proxy.is_a?(URI) ? proxy : URI.parser.parse(proxy) + @proxy = proxy.is_a?(URI) ? proxy : URI.parse(proxy) end # Sets the user for remote service. diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb index 0b219ce44a..bfe0832b37 100644 --- a/activesupport/lib/active_support/core_ext/uri.rb +++ b/activesupport/lib/active_support/core_ext/uri.rb @@ -20,7 +20,7 @@ end module URI class << self def parser - @parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI + @parser ||= URI::Parser.new end end end diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 4a6cbb8801..03e388dd7a 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -7,11 +7,7 @@ class URIExtTest < ActiveSupport::TestCase def test_uri_decode_handle_multibyte str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese. - if URI.const_defined?(:Parser) - parser = URI::Parser.new - assert_equal str, parser.unescape(parser.escape(str)) - else - assert_equal str, URI.unescape(URI.escape(str)) - end + parser = URI::Parser.new + assert_equal str, parser.unescape(parser.escape(str)) end end |