Sha256: 4dd085d3920eea81142c655477b43cd34ae4063110997bee4f89ea6b2de09795

Contents?: true

Size: 430 Bytes

Versions: 3

Compression:

Stored size: 430 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

3 entries across 3 versions & 1 rubygems

Version Path
database_cleaner-0.6.4 lib/database_cleaner/mongo/truncation.rb
database_cleaner-0.6.3 lib/database_cleaner/mongo/truncation.rb
database_cleaner-0.6.2 lib/database_cleaner/mongo/truncation.rb