class RuboCop::Cop::Style::StringLiteralsInInterpolation

regexp = /Tests #{success ? “PASS” : “FAIL”}/
TEXT
Tests #{success ? “PASS” : “FAIL”}
heredoc = <<~TEXT
symbol = :“Tests #{success ? ”PASS“ : ”FAIL“}”
string = “Tests #{success ? ”PASS“ : ”FAIL“}”
# good
regexp = /Tests #{success ? ‘PASS’ : ‘FAIL’}/
TEXT
Tests #{success ? ‘PASS’ : ‘FAIL’}
heredoc = <<~TEXT
symbol = :“Tests #{success ? ‘PASS’ : ‘FAIL’}”
string = “Tests #{success ? ‘PASS’ : ‘FAIL’}”
# bad
@example EnforcedStyle: double_quotes
regexp = /Tests #{success ? ‘PASS’ : ‘FAIL’}/
TEXT
Tests #{success ? ‘PASS’ : ‘FAIL’}
heredoc = <<~TEXT
symbol = :“Tests #{success ? ‘PASS’ : ‘FAIL’}”
string = “Tests #{success ? ‘PASS’ : ‘FAIL’}”
# good
regexp = /Tests #{success ? “PASS” : “FAIL”}/
TEXT
Tests #{success ? “PASS” : “FAIL”}
heredoc = <<~TEXT
symbol = :“Tests #{success ? ”PASS“ : ”FAIL“}”
string = “Tests #{success ? ”PASS“ : ”FAIL“}”
# bad
@example EnforcedStyle: single_quotes (default)
match the configured preference.
Checks that quotes inside string, symbol, and regexp interpolations

def autocorrect(corrector, node)

def autocorrect(corrector, node)
  StringLiteralCorrector.correct(corrector, node, style)
end

def message(_node)

def message(_node)
  # single_quotes -> single-quoted
  kind = style.to_s.sub(/_(.*)s/, '-\1d')
  "Prefer #{kind} strings inside interpolations."
end

def offense?(node)

def offense?(node)
  # If it's not a string within an interpolation, then it's not an
  # offense for this cop.
  return false unless inside_interpolation?(node)
  wrong_quotes?(node)
end

def on_regexp(node); end

definition with an empty one.
nodes. Not so for this cop, which is why we override the on_regexp
Cop classes that include the StringHelp module usually ignore regexp
def on_regexp(node); end