Module: DatabaseCleaner::Generic::Truncation::InstanceMethods

Defined in:
lib/database_cleaner/generic/truncation.rb

Instance Method Summary collapse

Instance Method Details

#cleanObject

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/database_cleaner/generic/truncation.rb', line 26

def clean
  raise NotImplementedError
end

#initialize(opts = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/database_cleaner/generic/truncation.rb', line 9

def initialize(opts={})
  if !opts.empty? && !(opts.keys - [:only, :except]).empty?
    raise ArgumentError, "The only valid options are :only and :except. You specified #{opts.keys.join(',')}."
  end
  if opts.has_key?(:only) && opts.has_key?(:except)
    raise ArgumentError, "You may only specify either :only or :either.  Doing both doesn't really make sense does it?"
  end

  @only = opts[:only]
  @tables_to_exclude = (opts[:except] || []).dup
  @tables_to_exclude << migration_storage_name unless migration_storage_name.nil?
end

#startObject



22
23
24
# File 'lib/database_cleaner/generic/truncation.rb', line 22

def start
  #included for compatability reasons, do nothing if you don't need to
end