Module: Quiver::Adapter::Memory::UuidPrimaryKey::ClassMethods

Defined in:
lib/quiver/adapter/memory_uuid_primary_key.rb

Instance Method Summary collapse

Instance Method Details

#next_pkObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/quiver/adapter/memory_uuid_primary_key.rb', line 10

def next_pk
  @pk_series ||= []

  new_pk = SecureRandom.uuid
  while @pk_series.include?(new_pk)
    new_pk = SecureRandom.uuid
  end

  @pk_series << new_pk
  new_pk
end