module Sanitize::Config

def self.merge(config, other_config = {})

your own custom config.
This is the safest way to use a built-in Sanitize config as the basis for

into *config*. Does not modify *config* or *other_config*.
Returns a new Hash containing the result of deeply merging *other_config*
def self.merge(config, other_config = {})
  raise ArgumentError, "config must be a Hash" unless Hash === config
  raise ArgumentError, "other_config must be a Hash" unless Hash === other_config
  merged = {}
  keys = Set.new(config.keys + other_config.keys)
  keys.each do |key|
    oldval = config[key]
    if other_config.has_key?(key)
      newval = other_config[key]
      merged[key] = if Hash === oldval && Hash === newval
        oldval.empty? ? newval.dup : merge(oldval, newval)
      elsif Array === newval && key != :transformers
        Set.new(newval)
      else
        can_dupe?(newval) ? newval.dup : newval
      end
    else
      merged[key] = can_dupe?(oldval) ? oldval.dup : oldval
    end
  end
  merged
end