class Rufo::Formatter

def visit_string_literal(node)

def visit_string_literal(node)
  # [:string_literal, [:string_content, exps]]
  heredoc = current_token_kind == :on_heredoc_beg
  tilde = current_token_value.include?("~")
  if heredoc
    write current_token_value.rstrip
    # Accumulate heredoc: we'll write it once
    # we find a newline.
    @heredocs << [node, tilde]
    # Get the next_token while capturing any output.
    # This is needed so that we can add a comma if one is not already present.
    captured_output = capture_output { next_token }
    inside_literal_elements_list = !@literal_elements_level.nil? &&
                                   (@node_level - @literal_elements_level) == 2
    needs_comma = !comma? && trailing_commas
    if inside_literal_elements_list && needs_comma
      @last_was_heredoc = true
      @end_of_heredoc_position = @output.length
    end
    @output << captured_output
    return
  elsif current_token_kind == :on_backtick
    consume_token :on_backtick
  else
    return if format_simple_string(node)
    consume_token :on_tstring_beg
  end
  visit_string_literal_end(node)
end