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

module SidekiqIteration
  # @private
  class NestedEnumerator
    def initialize(enums, cursor: nil)
      unless enums.all?(Proc)
        raise ArgumentError, "enums must contain only procs/lambdas"
      end

      if cursor && enums.size != cursor.size
     
    
      def iterate(current_items, current_cursor, index, &block)
        cursor = @cursor[index]
        enum = @enums[index].call(*current_items, cursor)

        enum.each do |item, cursor_value|
          if index == @cursor.size - 1
            yield item, current_cursor + [cursor_value]
          else
            iterate(current_items + [item], current_cursor + [cursor_value], index + 1, &block)
          end
        end