Class: Tartarus::ArchiveStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/tartarus/archive_strategy.rb,
lib/tartarus/archive_strategy/delete_all.rb,
lib/tartarus/archive_strategy/destroy_all.rb,
lib/tartarus/archive_strategy/extract_batch.rb,
lib/tartarus/archive_strategy/delete_all_without_batches.rb,
lib/tartarus/archive_strategy/destroy_all_without_batches.rb,
lib/tartarus/archive_strategy/delete_all_using_limit_in_batches.rb

Defined Under Namespace

Classes: DeleteAll, DeleteAllUsingLimitInBatches, DeleteAllWithoutBatches, DestroyAll, DestroyAllWithoutBatches, ExtractBatch

Instance Method Summary collapse

Instance Method Details

#for(strategy_name, batch_size: 0) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tartarus/archive_strategy.rb', line 2

def for(strategy_name, batch_size: 0)
  case strategy_name.to_sym
  when :delete_all
    Tartarus::ArchiveStrategy::DeleteAll.new
  when :destroy_all
    Tartarus::ArchiveStrategy::DestroyAll.new
  when :delete_all_without_batches
    Tartarus::ArchiveStrategy::DeleteAllWithoutBatches.new
  when :destroy_all_without_batches
    Tartarus::ArchiveStrategy::DestroyAllWithoutBatches.new
  when :delete_all_using_limit_in_batches
    Tartarus::ArchiveStrategy::DeleteAllUsingLimitInBatches.new(batch_size: batch_size)
  else
    raise "unknown strategy: #{strategy_name}"
  end
end