class PhilColumns::Purger

Attributes

config[R]

Public Class Methods

new( config ) click to toggle source
# File lib/phil_columns/purger.rb, line 6
def initialize( config )
  @config = config
end

Public Instance Methods

purge() click to toggle source
# File lib/phil_columns/purger.rb, line 10
def purge
  tables.each do |table|
    if config.skip &&
        config.skip_tables_on_purge.include?( table )
      say "Skipping #{table}", :yellow
      next
    end

    confirm "Purging #{table} ... " do
      klass = table.classify.constantize
      klass.delete_all
    end
  end

  archivist.clear_seeds
end

Protected Instance Methods

archivist() click to toggle source
# File lib/phil_columns/purger.rb, line 35
def archivist
  @archivist ||= PhilColumns::Archivist.new
end
migrator() click to toggle source
# File lib/phil_columns/purger.rb, line 39
def migrator
  @migrator ||= PhilColumns::Migrator.new( config )
end
tables() click to toggle source
# File lib/phil_columns/purger.rb, line 31
def tables
  migrator.tables.sort
end