Skip to content

Commit

Permalink
🚧 seq-set updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nevans committed Nov 27, 2023
1 parent d191357 commit d29d329
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/net/imap/sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,15 @@ def complement!
# # => Net::IMAP::SequenceSet["1:7,9:11"]
def normalize; dup.normalize! end

# Sorts, deduplicates, and merges the #string, as appropriate
def normalize!; @string = -@tuples.map { tuple_to_str _1 }.join(",") end
# Updates #string to be sorted, deduplicated, and coalesced. Returns
# self.
def normalize!
@string = -@tuples.map { tuple_to_str _1 }.join(",")
self
end

def inspect
if frozen?
if frozen? && !empty?
"%s[%p]" % [self.class, to_s]
else
"#<%s %s>" % [self.class, empty? ? "empty" : to_s.inspect]
Expand Down

0 comments on commit d29d329

Please sign in to comment.