Module: DataCleansing

Includes:
SemanticLogger::Loggable
Defined in:
lib/data_cleansing.rb,
lib/data_cleansing/cleanse.rb,
lib/data_cleansing/version.rb,
lib/data_cleansing/data_cleansing.rb

Defined Under Namespace

Modules: Cleanse

Constant Summary collapse

VERSION =
"0.6.1"
@@global_cleaners =

Global Data Cleansers

ThreadSafe::Hash.new
@@masked_attributes =
ThreadSafe::Array.new

Class Method Summary collapse

Class Method Details

.cleaner(cleaner_name) ⇒ Object

Returns the cleaner matching the supplied cleaner name



16
17
18
# File 'lib/data_cleansing/data_cleansing.rb', line 16

def self.cleaner(cleaner_name)
  @@global_cleaners[cleaner_name.to_sym]
end

.masked_attributesObject

Returns the Global list of attributes to mask in any log output



26
27
28
# File 'lib/data_cleansing/data_cleansing.rb', line 26

def self.masked_attributes
  @@masked_attributes.freeze
end

.register_cleaner(cleaner, &block) ⇒ Object

Register a new cleaner Replaces any existing cleaner with the same name



10
11
12
13
# File 'lib/data_cleansing/data_cleansing.rb', line 10

def self.register_cleaner(cleaner, &block)
  raise "Must supply a Proc with the cleaner" unless block
  @@global_cleaners[cleaner.to_sym] = block
end

.register_masked_attributes(*attributes) ⇒ Object

Register Attributes to be masked out in any log output



21
22
23
# File 'lib/data_cleansing/data_cleansing.rb', line 21

def self.register_masked_attributes(*attributes)
  attributes.each {|attr| @@masked_attributes << attr.to_sym }
end