Skip to content

Commit e366c3a

Browse files
committed
♻️ Simplify and format resp-text-code case stmt
Move assignment outside the case stmt and reformat to one-line cases.
1 parent 321a859 commit e366c3a

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

lib/net/imap/response_parser.rb

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,26 +1496,21 @@ def resp_text
14961496
# "MODIFIED" SP sequence-set
14971497
def resp_text_code
14981498
name = resp_text_code__name
1499-
case name
1500-
when "ALERT", "PARSE", "READ-ONLY", "READ-WRITE", "TRYCREATE", "NOMODSEQ"
1501-
data = nil
1502-
when "BADCHARSET"
1503-
data = charset_list
1504-
when "CAPABILITY"
1505-
data = capability__list
1506-
when "PERMANENTFLAGS"
1507-
SP!
1508-
data = flag_list
1509-
when "UIDVALIDITY", "UIDNEXT", "UNSEEN"
1510-
SP!
1511-
data = number
1512-
when "APPENDUID"
1513-
data = resp_code_apnd__data
1514-
when "COPYUID"
1515-
data = resp_code_copy__data
1516-
else
1517-
data = SP? && text_chars_except_rbra
1518-
end
1499+
data =
1500+
case name
1501+
when "ALERT", "PARSE", "READ-ONLY", "READ-WRITE", "TRYCREATE"
1502+
when "NOMODSEQ" # CONDSTORE
1503+
when "BADCHARSET" then charset_list
1504+
when "CAPABILITY" then capability__list
1505+
when "PERMANENTFLAGS" then SP!; flag_list
1506+
when "UIDVALIDITY" then SP!; number
1507+
when "UIDNEXT" then SP!; number
1508+
when "UNSEEN" then SP!; number
1509+
when "APPENDUID" then resp_code_apnd__data
1510+
when "COPYUID" then resp_code_copy__data
1511+
else
1512+
SP? and text_chars_except_rbra
1513+
end
15191514
ResponseCode.new(name, data)
15201515
end
15211516

0 commit comments

Comments
 (0)