You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: format_attachments.rb
    path of file: ./repos/slack-notifier/lib/slack-notifier/payload_middleware
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Slack
  class Notifier
    class PayloadMiddleware
      class FormatAttachments < Base
        middleware_name :format_attachments
    
        def call payload={}
          payload = payload.dup
          attachments = payload.delete(:attachments)
          attachments ||= payload.delete("attachments")

          attachments = wrap_array(attachments).map do |attachment|
            ["text", :text].each do |key|
              if attachment.key?(key)
                attachment[key] = Util::LinkFormatter.format(attachment[key], options)
              end
            end

            attachment
          end