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: capistrano_2_tasks.rb
    path of file: ./repos/appsignal-ruby/lib/appsignal/integrations/capistrano
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Appsignal
  # @todo Move to sub-namespace
  # @api private
  class Capistrano
    def self.tasks(config)
      config.load do # rubocop:disable Metrics/BlockLength
        after "deploy", "appsignal:deploy"
        after "deploy:migrations", "a
    
    def self.tasks(config)
      config.load do # rubocop:disable Metrics/BlockLength
        after "deploy", "appsignal:deploy"
        after "deploy:migrations", "appsignal:deploy"

        namespace :appsignal do
          task :deploy do
            env = fetch(:appsignal_env,
              fetch(:stage, fetch(:rails_env, fetch(:rack_env, "production"))))
            user = fetch(:appsignal_user, ENV["USER"] || ENV.fetch("USERNAME", nil))
            revision = fetch(:appsignal_revision, fetch(:current_revision))

            appsignal_config = Appsignal::Config.new(
              ENV.fetch("PWD", nil),
              env,
              {},
              Appsignal::Utils::IntegrationLogger.new(StringIO.new)
            ).tap do |c|
              fetch(:appsignal_config, {}).each do |key, value|
                c[key] = value
              end
              c.validate
            end

            if appsignal_config&.active?
              marker_data = {
                :revision => revision,
                :user => user
              }

              marker = Marker.new(marker_data, appsignal_config)
              if config.dry_run
                puts "Dry run: AppSignal deploy marker not actually sent."
              else
                marker.transmit
              end
            else
              puts "Not notifying of deploy, config is not active for environment: #{env}"
            end
          end
        end