Sha256: 16b28d44f0859d5fa4026aae52a919c8cc71daf56a63a2858e880452a4442365

Contents?: true

Size: 714 Bytes

Versions: 3

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true
require 'set'

require 'database_flusher/version'
require 'database_flusher/null_strategy'
require 'database_flusher/cleaner'

require 'database_flusher/active_record/deletion_strategy'
require 'database_flusher/active_record/transaction_strategy'
require 'database_flusher/mongoid/deletion_strategy'

module DatabaseFlusher
  extend self

  def cleaners
    @cleaners ||= {}
  end

  def [](name)
    cleaners[name] ||= DatabaseFlusher::Cleaner.new(name)
  end

  def start
    cleaners.values.each(&:start)
  end

  def stop
    cleaners.values.each(&:stop)
  end

  def clean
    cleaners.values.each(&:clean)
  end

  def cleaning
    start
    yield
  ensure
    clean
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
database_flusher-0.3.4 lib/database_flusher.rb
database_flusher-0.3.3 lib/database_flusher.rb
database_flusher-0.3.2 lib/database_flusher.rb