class DbObfuscation::Truncation

Public Class Methods

tables() click to toggle source
# File lib/db_obfuscation/truncation.rb, line 12
def self.tables
  new.send(:tables)
end
truncate() click to toggle source
# File lib/db_obfuscation/truncation.rb, line 8
def self.truncate
  new.send(:truncate)
end

Private Instance Methods

patterns() click to toggle source
# File lib/db_obfuscation/truncation.rb, line 35
def patterns
  Config.truncation_patterns
end
tables() click to toggle source
# File lib/db_obfuscation/truncation.rb, line 31
def tables
  Filtering::Truncation.matches_patterns(DB.tables, patterns)
end
truncate() click to toggle source
# File lib/db_obfuscation/truncation.rb, line 18
def truncate
  tables.each do |table|
    begin
      DbObfuscation.logging.info "Truncating #{table}"
      DB[table].truncate
    rescue => e
      DbObfuscation.logging.error "#{table} encountered #{e.message}"
      DbObfuscation.logging.error "#{e.backtrace}"
    end

  end
end