class Nokogiri::EncodingHandler

def [](key)

def [](key)
  handler = LibXML.xmlFindCharEncodingHandler(key)
  handler.null? ? nil : wrap(handler)
end

def alias(from, to)

def alias(from, to)
  LibXML.xmlAddEncodingAlias(from, to)
  to
end

def clear_aliases!

def clear_aliases!
  LibXML.xmlCleanupEncodingAliases
  self
end

def delete(name)

def delete(name)
  (LibXML.xmlDelEncodingAlias(name) != 0) ? nil : true
end

def name

def name
  cstruct[:name]
end

def wrap(ptr)

def wrap(ptr)
  cstruct = LibXML::XmlCharEncodingHandler.new(ptr)
  eh = Nokogiri::EncodingHandler.allocate
  eh.cstruct = cstruct
  eh
end