utils/service: simplify

This commit is contained in:
Ruoyu Zhong 2024-12-04 03:09:11 +08:00
parent bba67ec02e
commit a8a6a5bdb7
No known key found for this signature in database

View File

@ -58,26 +58,16 @@ module Utils
# quoting the entire string.
str.each_char do |char|
result << case char
when "\a"
"\\a"
when "\b"
"\\b"
when "\f"
"\\f"
when "\n"
"\\n"
when "\r"
"\\r"
when "\t"
"\\t"
when "\v"
"\\v"
when "\\"
"\\\\"
when "\""
"\\\""
else
char
when "\a" then "\\a"
when "\b" then "\\b"
when "\f" then "\\f"
when "\n" then "\\n"
when "\r" then "\\r"
when "\t" then "\\t"
when "\v" then "\\v"
when "\\" then "\\\\"
when "\"" then "\\\""
else char
end
end
result << "\""