Class: Tartarus::ArchiveStrategy::DeleteAllUsingLimitInBatches

Inherits:
Object
  • Object
show all
Defined in:
lib/tartarus/archive_strategy/delete_all_using_limit_in_batches.rb

Instance Method Summary collapse

Constructor Details

#initialize(batch_size:) ⇒ DeleteAllUsingLimitInBatches

Returns a new instance of DeleteAllUsingLimitInBatches.



7
8
9
# File 'lib/tartarus/archive_strategy/delete_all_using_limit_in_batches.rb', line 7

def initialize(batch_size:)
  @batch_size = batch_size
end

Instance Method Details

#call(collection) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/tartarus/archive_strategy/delete_all_using_limit_in_batches.rb', line 11

def call(collection)
  num = 1

  while num > 0
    num = collection.limit(batch_size).delete_all
  end
end