Class: DatabaseCleaner::Redis::Truncation
- Inherits:
-
Object
- Object
- DatabaseCleaner::Redis::Truncation
- Includes:
- Generic::Truncation, Base
- Defined in:
- lib/database_cleaner/redis/truncation.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods included from Generic::Truncation
Methods included from Base
Methods included from Generic::Base
Instance Method Details
#clean ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/database_cleaner/redis/truncation.rb', line 10 def clean if @only @only.each do |term| connection.keys(term).each { |k| connection.del k } end elsif @tables_to_exclude keys_except = [] @tables_to_exclude.each { |term| keys_except += connection.keys(term) } connection.keys.each { |k| connection.del(k) unless keys_except.include?(k) } else connection.flushdb end connection.quit unless url == :default end |