Sha256: 8b7a09a6577bc5ea367fbf7053867a19fecbbd93c61b706ce9b0421ba5593edb

Contents?: true

Size: 454 Bytes

Versions: 4

Compression:

Stored size: 454 Bytes

Contents

module DatabaseCleaner
  module Mongo
    module Truncation

      def clean
        if @only
          collections.each { |c| c.remove if @only.include?(c.name) }
        else
          collections.each { |c| c.remove unless @tables_to_exclude.include?(c.name) }
        end
        true
      end

      private

      def collections
        database.collections.select { |c| c.name !~ /^system\./ }
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
surgical_strike-0.7.7 lib/database_cleaner/mongo/truncation.rb
surgical_strike-0.7.6 lib/database_cleaner/mongo/truncation.rb
surgical_strike-0.7.5 lib/database_cleaner/mongo/truncation.rb
surgical_strike-0.7.4 lib/database_cleaner/mongo/truncation.rb