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

Version Path
autocompl-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/database_cleaner-1.5.3/lib/database_cleaner/redis/truncation.rb
database_cleaner-1.5.3 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.5.2 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.5.1 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.5.0 lib/database_cleaner/redis/truncation.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/redis/truncation.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/redis/truncation.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/database_cleaner-1.4.1/lib/database_cleaner/redis/truncation.rb
database_cleaner-1.4.1 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.4.0 lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/database_cleaner-1.2.0/lib/database_cleaner/redis/truncation.rb
database_cleaner-1.3.0 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.2.0 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.1.1 lib/database_cleaner/redis/truncation.rb
database_cleaner-1.1.0 lib/database_cleaner/redis/truncation.rb