Sha256: 0052710a3fd54d13ffc03c1d980c4530236670f2202e661d2d2ebb377b30d18b

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

module DataCleansing

  # Global Data Cleansers
  @@global_cleaners = ThreadSafe::Hash.new

  # Register a new cleaner
  # Replaces any existing cleaner with the same name
  def self.register_cleaner(cleaner, &block)
    if block
      @@global_cleaners[cleaner.to_sym] = block
    else
      # TODO Expose class methods as cleaners
      #
      # cleaners[cleaner.to_sym] = block
      # raise ArgumentError, "Must supply either a Proc, or a cleaner klass"
    end
  end

  # Returns the cleaner matching the supplied cleaner name
  def self.cleaner(cleaner_name)
    @@global_cleaners[cleaner_name.to_sym]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
data_cleansing-0.3.2 lib/data_cleansing/data_cleansing.rb
data_cleansing-0.3.1 lib/data_cleansing/data_cleansing.rb
data_cleansing-0.3.0 lib/data_cleansing/data_cleansing.rb
data_cleansing-0.2.0 lib/data_cleansing/data_cleansing.rb