Class: DataTaster::Sanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/data_taster/sanitizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(table_name, custom_selections) ⇒ Sanitizer

Ensures the given tables are cleaned of information deemed sensitive



7
8
9
10
11
# File 'lib/data_taster/sanitizer.rb', line 7

def initialize(table_name, custom_selections)
  @table_name = table_name
  @custom_selections = custom_selections || {}
  @include_insert = DataTaster.config.include_insert
end

Instance Method Details

#clean!Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/data_taster/sanitizer.rb', line 13

def clean!
  return if skippable_table?

  # custom selections should ALWAYS override defaults
  default_selections.merge(custom_selections).filter_map do |column_name, sanitized_value|
    sql = DataTaster::Detergent.new(
      table_name, column_name, sanitized_value
    ).deliver

    process(sql)
  end
end