mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Emulate behavior of URI() of ruby >=1.9 where it raises ArgumentError.
This commit is contained in:
parent
9b4ce19873
commit
726e2f89ea
1 changed files with 8 additions and 1 deletions
|
|
@ -14,7 +14,14 @@ if RUBY_VERSION < "1.9.3"
|
|||
URI(URI(''))
|
||||
rescue
|
||||
def URI(url) # :nodoc:
|
||||
url.is_a?(URI) ? url : URI.parse(url)
|
||||
case url
|
||||
when URI
|
||||
url
|
||||
when String
|
||||
URI.parse(url)
|
||||
else
|
||||
raise ArgumentError, 'bad argument (expected URI object or URI string)'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue