Class: Obfuscator::Generic

Inherits:
Object
  • Object
show all
Defined in:
lib/obfuscator/generic.rb

Defined Under Namespace

Classes: UnkownObfuscationTypeError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnsObject

Returns the value of attribute columns.



5
6
7
# File 'lib/obfuscator/generic.rb', line 5

def columns
  @columns
end

#modelObject

Returns the value of attribute model.



5
6
7
# File 'lib/obfuscator/generic.rb', line 5

def model
  @model
end

Instance Method Details

#scrub!(model_name = "User", columns = []) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/obfuscator/generic.rb', line 7

def scrub!(model_name = "User", columns = [])
  @model = model_name.singularize.constantize

  if columns.is_a?(Hash)
    store_types_from_column_values(columns)
    @columns = columns.keys
  else
    @columns = columns
  end

  return unless @columns.any? and @columns.map!(&:to_s)

  scrub_all_records!
end