summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-13 05:33:45 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-13 05:33:45 +0000
commit0cddf1b4331877019f65bf3ba572f7f8d0371115 (patch)
tree617c2585922a828614980db85a892f0cc04f7998 /lib
parentdd4cf6bbeb4ae5dd03d9b6cb3c2a4e73e2ab8b34 (diff)
merge revision(s) 49095: [Backport #11144]
* lib/resolv.rb (Resolv::DNS::Label::Str#==): Check class equality. (Resolv::DNS::Name#initialize): Normalize labels as Resolv::DNS::Label::Str objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/resolv.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index 74618bfaab..78c2b459fe 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1187,7 +1187,7 @@ class Resolv
end
def ==(other)
- return @downcase == other.downcase
+ return self.class == other.class && @downcase == other.downcase
end
def eql?(other)
@@ -1223,6 +1223,14 @@ class Resolv
end
def initialize(labels, absolute=true) # :nodoc:
+ labels = labels.map {|label|
+ case label
+ when String then Label::Str.new(label)
+ when Label::Str then label
+ else
+ raise ArgumentError, "unexpected label: #{label.inspect}"
+ end
+ }
@labels = labels
@absolute = absolute
end