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: unique_generator.rb
    path of file: ./repos/gimei/lib/gimei
    
    the code of the file until where you have to start completion: class Gimei
  class RetryLimitExceeded < StandardError; end

  class UniqueGenerator
    class << self
      def previous_results
        @previous_results ||= Hash.new { |hash, key| hash[key] = Set.new }
      end
  
    
    def define_unique_method(method_name, previous_result_key = method_name)
      define_singleton_method method_name do |*args|
        max_retries.times do
          result = klass.public_send(method_name, *args)

          next if previous_results[previous_result_key].include?(result.to_s)

          previous_results[previous_result_key] << result.to_s
          return result
        end

        raise RetryLimitExceeded, "Retry limit exceeded for #{method_name}"
      end
    end