class Sanitize

def initialize(config = {})

Returns a new Sanitize object initialized with the settings in _config_.
def initialize(config = {})
  # Sanitize configuration.
  @config = Config::DEFAULT.merge(config)
  @config[:transformers] = Array(@config[:transformers].dup)
  # Convert the list of allowed elements to a Hash for faster lookup.
  @allowed_elements = {}
  @config[:elements].each {|el| @allowed_elements[el] = true }
  # Convert the list of :remove_contents elements to a Hash for faster lookup.
  @remove_all_contents     = false
  @remove_element_contents = {}
  if @config[:remove_contents].is_a?(Array)
    @config[:remove_contents].each {|el| @remove_element_contents[el] = true }
  else
    @remove_all_contents = !!@config[:remove_contents]
  end
  # Specific nodes to whitelist (along with all their attributes). This array
  # is generated at runtime by transformers, and is cleared before and after
  # a fragment is cleaned (so it applies only to a specific fragment).
  @whitelist_nodes = []
  # Workaround for a fragment parsing bug in Nokogiri >= 1.4.2. The naïve
  # version check is fine here; there are no side effects for unaffected
  # versions except slightly worse performance, and I plan to remove this hack
  # as soon as Nokogiri fixes the bug on their end.
  if Nokogiri::VERSION > '1.4.1'
    @config[:transformers] << Transformers::FIX_FRAGMENT_CDATA
  end
end