Class: PhilColumns::Purger

Inherits:
Object
  • Object
show all
Includes:
Output
Defined in:
lib/phil_columns/purger.rb

Instance Method Summary collapse

Methods included from Output

#confirm, included, #say, #say_error, #say_ok, #say_skipping, #write

Constructor Details

#initialize(config) ⇒ Purger

Returns a new instance of Purger.



6
7
8
# File 'lib/phil_columns/purger.rb', line 6

def initialize( config )
  @config = config
end

Instance Method Details

#purgeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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