Class: DatabaseCleaner::TruncationBase
- Inherits:
-
Object
- Object
- DatabaseCleaner::TruncationBase
- Defined in:
- lib/database_cleaner/truncation_base.rb
Direct Known Subclasses
ActiveRecord::Truncation, CouchPotato::Truncation, DataMapper::Truncation, MongoMapper::Truncation, Mongoid::Truncation
Instance Method Summary collapse
- #clean ⇒ Object
-
#initialize(options = {}) ⇒ TruncationBase
constructor
A new instance of TruncationBase.
- #start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ TruncationBase
Returns a new instance of TruncationBase.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/database_cleaner/truncation_base.rb', line 4 def initialize( = {}) if !.empty? && !(.keys - [:only, :except]).empty? raise ArgumentError, "The only valid options are :only and :except. You specified #{.keys.join(',')}." end if .has_key?(:only) && .has_key?(:except) raise ArgumentError, "You may only specify either :only or :either. Doing both doesn't really make sense does it?" end @only = [:only] @tables_to_exclude = ([:except] || []) if migration_storage = migration_storage_name @tables_to_exclude << migration_storage end end |
Instance Method Details
#clean ⇒ Object
23 24 25 |
# File 'lib/database_cleaner/truncation_base.rb', line 23 def clean raise NotImplementedError end |
#start ⇒ Object
19 20 21 |
# File 'lib/database_cleaner/truncation_base.rb', line 19 def start # no-op end |