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: new_class_helper.rb
    path of file: ./repos/dynamoid/spec/support/helpers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# Declaration DSL of partition key and sort key is weird.
# So let's use helpers to simplify class declaration in specs.
module NewClassHelper
  def new_class(options = {}, &block)
    table_name = options[:table_name] || :"documents_#{Time.now.to_i}_#{rand(1000)}"
    class_name = (options[:class_name] || table_name).to_s.classify
    partition_key = options[:partition_key]

    klass = Class.new do
      include Dynamoid::Document

      if partition_key
        if partition_key.is_a? Hash
          table name: table_name, key: partition_key[:name]
          if partition_key[:options]
          
    
  def new_class(options = {}, &block)
    table_name = options[:table_name] || :"documents_#{Time.now.to_i}_#{rand(1000)}"
    class_name = (options[:class_name] || table_name).to_s.classify
    partition_key = options[:partition_key]

    klass = Class.new do
      include Dynamoid::Document

      if partition_key
        if partition_key.is_a? Hash
          table name: table_name, key: partition_key[:name]
          if partition_key[:options]
            field partition_key[:name], partition_key[:type] || :string, partition_key[:options]
          else
            field partition_key[:name], partition_key[:type] || :string
          end
        else
          table name: table_name, key: partition_key
          field partition_key
        end