Sha256: ed2c6b280d131a9c93939aef39ca46cedb2cdae98f8f70b095f5eb856bded634
Contents?: true
Size: 744 Bytes
Versions: 41
Compression:
Stored size: 744 Bytes
Contents
require 'database_cleaner/redis/base' require 'database_cleaner/generic/truncation' module DatabaseCleaner module Redis class Truncation include ::DatabaseCleaner::Redis::Base include ::DatabaseCleaner::Generic::Truncation 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 end end end
Version data entries
41 entries across 36 versions & 5 rubygems