class RuboCop::Cop::Style::RedundantInterpolationUnfreeze
“#{foo} bar”
# good
“#{foo} bar”.dup
# bad
+“#{foo} bar”
# bad
@example
unfreezing them redundant.
Ruby 3.0 changed interpolated strings to always be unfrozen which makes
magic comment which sometimes made it necessary to explicitly unfreeze them.
Before Ruby 3.0, interpolated strings followed the frozen string literal
def on_send(node)
def on_send(node) return if node.arguments? return unless (receiver = node.receiver) return unless receiver.dstr_type? return if uninterpolated_string?(receiver) || uninterpolated_heredoc?(receiver) add_offense(node.loc.selector) do |corrector| corrector.remove(node.loc.selector) corrector.remove(node.loc.dot) unless node.unary_operation? end end