diff --git a/lib/domain_name.rb b/lib/domain_name.rb index dc8b45c..bcea018 100644 --- a/lib/domain_name.rb +++ b/lib/domain_name.rb @@ -146,10 +146,10 @@ def <=>(other) othername = other.hostname if othername == @hostname 0 - elsif @hostname.end_with?(othername) && @hostname[-othername.size - 1] == '.' + elsif @hostname.end_with?(othername) && @hostname[-othername.size - 1, 1] == '.' # The other is higher -1 - elsif othername.end_with?(@hostname) && othername[-@hostname.size - 1] == '.' + elsif othername.end_with?(@hostname) && othername[-@hostname.size - 1, 1] == '.' # The other is lower 1 else