utils/service: simplify
This commit is contained in:
parent
bba67ec02e
commit
a8a6a5bdb7
@ -58,26 +58,16 @@ module Utils
|
|||||||
# quoting the entire string.
|
# quoting the entire string.
|
||||||
str.each_char do |char|
|
str.each_char do |char|
|
||||||
result << case char
|
result << case char
|
||||||
when "\a"
|
when "\a" then "\\a"
|
||||||
"\\a"
|
when "\b" then "\\b"
|
||||||
when "\b"
|
when "\f" then "\\f"
|
||||||
"\\b"
|
when "\n" then "\\n"
|
||||||
when "\f"
|
when "\r" then "\\r"
|
||||||
"\\f"
|
when "\t" then "\\t"
|
||||||
when "\n"
|
when "\v" then "\\v"
|
||||||
"\\n"
|
when "\\" then "\\\\"
|
||||||
when "\r"
|
when "\"" then "\\\""
|
||||||
"\\r"
|
else char
|
||||||
when "\t"
|
|
||||||
"\\t"
|
|
||||||
when "\v"
|
|
||||||
"\\v"
|
|
||||||
when "\\"
|
|
||||||
"\\\\"
|
|
||||||
when "\""
|
|
||||||
"\\\""
|
|
||||||
else
|
|
||||||
char
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
result << "\""
|
result << "\""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user