class DbObfuscation::BatchFormulator

Public Class Methods

batch_for(*args) click to toggle source
# File lib/db_obfuscation/batch_formulator.rb, line 7
def self.batch_for(*args)
  self.new.batch_for(*args)
end

Public Instance Methods

batch_for(config, ids) click to toggle source
# File lib/db_obfuscation/batch_formulator.rb, line 11
def batch_for(config, ids)
  ids.each_with_object([]) do |id, batch|
    batch<<obfuscate_row(config, id)
  end
end

Private Instance Methods

obfuscate_row(config, id) click to toggle source
# File lib/db_obfuscation/batch_formulator.rb, line 19
def obfuscate_row(config, id)
  config.each_with_object({}) do |(column, strategy), obfuscated_hash|
    value = Obfuscator.obfuscate(strategy)
    obfuscated_hash[column] = DB.literal value
  end.merge(id: id)
end