summaryrefslogtreecommitdiff
path: root/lib/uri
diff options
context:
space:
mode:
Diffstat (limited to 'lib/uri')
-rw-r--r--lib/uri/generic.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 2c453dc9db..0435fd25ce 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -86,8 +86,8 @@ module URI
rescue InvalidComponentError
if args.kind_of?(Array)
return self.build(args.collect{|x|
- if x
- parser.escape(x)
+ if x.is_a?(String)
+ DEFAULT_PARSER.escape(x)
else
x
end
@@ -96,7 +96,7 @@ module URI
tmp = {}
args.each do |key, value|
tmp[key] = if value
- parser.escape(value)
+ DEFAULT_PARSER.escape(value)
else
value
end
@@ -121,7 +121,7 @@ module URI
def self.build(args)
if args.kind_of?(Array) &&
args.size == ::URI::Generic::COMPONENT.size
- tmp = args
+ tmp = args.dup
elsif args.kind_of?(Hash)
tmp = ::URI::Generic::COMPONENT.collect do |c|
if args.include?(c)
@@ -131,8 +131,9 @@ module URI
end
end
else
+ component = self.class.component rescue ::URI::Generic::COMPONENT
raise ArgumentError,
- "expected Array of or Hash of components of #{self.class} (#{self.class.component.join(', ')})"
+ "expected Array of or Hash of components of #{self.class} (#{component.join(', ')})"
end
tmp << nil