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: credentials.rb
    path of file: ./repos/mongo-ruby-driver/lib/mongo/crypt/kms
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
# rubocop:todo all

# Copyright (C) 2019-2021 MongoDB Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
    
        def to_document
          BSON::Document.new.tap do |bson|
            bson[:aws] = @aws.to_document if @aws
            bson[:azure] = @azure.to_document if @azure
            bson[:gcp] = @gcp.to_document if @gcp
            bson[:kmip] = @kmip.to_document if @kmip
            bson[:local] = @local.to_document if @local
          end
        end