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: plan.rb
    path of file: ./repos/clowne/lib/clowne/utils
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Clowne
  module Utils
    class Plan # :nodoc: all
      class TwoPhaseSet
        def initialize
          @added = {}
          @removed = []
        end

        def []=(k, v)
          return if @removed.include?(k)

          @added[k] = v
        end

        def delete(k)
          return if @removed.include?(k)

          @removed << k
          @added.delete(k)
    
    
      def declarations(reload = false)
        return @declarations if !reload && instance_variable_defined?(:@declarations)

        @declarations =
          registry.actions.flat_map do |type|
            value = data[type]
            next if value.nil?

            value = value.values if value.is_a?(TwoPhaseSet)
            value = Array(value)
            value.map { |v| [type, v] }
          end.compact
      end

      def dup
        self.class.new(registry).tap do |duped|
          data.each do |k, v|
            duped.set(k, v.dup)
          end
        end
      end

      private

      attr_reader :data, :registry
    end