module ActiveLdap::Ldif::Attributes

def encode(attributes)

def encode(attributes)
  return "" if attributes.empty?
  result = ""
  normalize(attributes).sort_by {|name,| name}.each do |name, values|
    values.each do |options, value|
      result << Attribute.encode([name, *options].join(";"), value)
    end
  end
  result
end

def normalize(attributes)

def normalize(attributes)
  result = {}
  attributes.each do |name, values|
    result[name] = Attribute.normalize_value(values).sort
  end
  result
end