Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/net/imap/sequence_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,16 @@ def deconstruct; valid? ? [normalized_string] : [] end
# Use #add, #merge, or #append to add a string to an existing set.
#
# Related: #replace, #clear
def string=(str)
if str.nil?
def string=(input)
if input.nil?
clear
else
modifying! # redundant check, to normalize the error message for JRuby
str = String.try_convert(str) or raise ArgumentError, "not a string"
elsif (str = String.try_convert(input))
modifying! # short-circuit before parsing the string
tuples = str_to_tuples str
@tuples, @string = [], -str
tuples_add tuples
else
raise ArgumentError, "expected a string or nil, got #{input.class}"
end
str
end
Expand Down
Loading