class Net::IMAP::SearchResult

def ==(other)


[3, 5, 7] == Net::IMAP::SearchResult[3, 5, 7, modseq: 99] # => true
[9, 8, 6, 4, 1] == Net::IMAP::SearchResult[1, 4, 6, 8, 9] # => false

Note that Array#== does require matching order and ignores #modseq.

Net::IMAP::SearchResult[3, 5, 7, modseq: 99] == [3, 5, 7] # => false
Net::IMAP::SearchResult[9, 8, 6, 4, 1] == [1, 4, 6, 8, 9] # => true

the array is sorted.
SearchResult can be compared directly with Array, if #modseq is nil and

# => false
Net::IMAP::SearchResult[1, 2, 3, modseq: 9999]
Net::IMAP::SearchResult[123, 456, modseq: 789] ==
# => false
Net::IMAP::SearchResult[987, 654, modseq: 789]
Net::IMAP::SearchResult[123, 456, modseq: 789] ==

# => true
Net::IMAP::SearchResult[456, 123, modseq: 789]
Net::IMAP::SearchResult[123, 456, modseq: 789] ==
# => true
Net::IMAP::SearchResult[123, 456, modseq: 789]
Net::IMAP::SearchResult[123, 456, modseq: 789] ==

same #modseq. The order of numbers is irrelevant.
Returns whether +other+ is a SearchResult with the same values and the
def ==(other)
  (modseq ?
   other.is_a?(self.class) && modseq == other.modseq :
   other.is_a?(Array)) &&
    size == other.size &&
    sort == other.sort
end