summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-02 00:10:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-02 00:10:04 +0000
commitec7f1f5dc23b331e09340e0431b17eb5307aeddb (patch)
tree7246b68406b6e6db6e10214d5dcfdbac1cd60b11 /lib
parent31d24fae56f5564f9d9e13520b69e4f8575ef650 (diff)
* 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/trunk@49095 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 3b7ab2a..a801cf6 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1185,7 +1185,7 @@ class Resolv
end
def ==(other)
- return @downcase == other.downcase
+ return self.class == other.class && @downcase == other.downcase
end
def eql?(other)
@@ -1221,6 +1221,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