Sha256: 2ad7b4b06203e7bc2e6226526c21e4b670777754bc5553e6e60577d39a0b22f3

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

require "database_cleaner/generic/truncation"
require 'database_cleaner/sequel/base'

module DatabaseCleaner
  module Sequel
    class Truncation
      include ::DatabaseCleaner::Sequel::Base
      include ::DatabaseCleaner::Generic::Truncation
  
      def clean
        each_table do |db, table|
          db[table].truncate
        end
      end
  
      def each_table
        tables_to_truncate(db).each do |table|
          yield db, table
        end
      end

      private
  
      def tables_to_truncate(db)
        (@only || db.tables) - @tables_to_exclude
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
database_cleaner-0.7.1 lib/database_cleaner/sequel/truncation.rb
database_cleaner-0.7.0 lib/database_cleaner/sequel/truncation.rb