module RuboCop::Cop::Util
def double_quotes_required?(string)
If converting a string to Ruby string literal source code, must
def double_quotes_required?(string) # Double quotes are required for strings which either: # - Contain single quotes # - Contain non-printable characters, which must use an escape # Regex matches IF there is a ' or there is a \\ in the string that is # not preceded/followed by another \\ (e.g. "\\x34") but not "\\\\". string =~ /'|(?<! \\) \\{2}* \\ (?![\\"])/x end