/usr/lib/ruby/vendor_ruby/database_cleaner/redis/truncation.rb is in ruby-database-cleaner 1.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 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
|