mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-04-27 14:57:46 +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(''))
|
URI(URI(''))
|
||||||
rescue
|
rescue
|
||||||
def URI(url) # :nodoc:
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue