class RuboCop::Cop::Lint::RedundantStringCoercion

“result is #{something}”
# good
@example
“result is #{something.to_s}”
# bad
@example
which is redundant.
This cop checks for string conversion in string interpolation,

def on_interpolation(begin_node)

def on_interpolation(begin_node)
  final_node = begin_node.children.last
  return unless to_s_without_args?(final_node)
  message = final_node.receiver ? MSG_DEFAULT : MSG_SELF
  add_offense(final_node.loc.selector, message: message) do |corrector|
    receiver = final_node.receiver
    corrector.replace(
      final_node,
      if receiver
        receiver.source
      else
        'self'
      end
    )
  end
end