# module ActiveLdap::Ldif::Attributes

### Public Instance Methods

encode(attributes) click to toggle source

    # File lib/active_ldap/ldif.rb, line 9
    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

normalize(attributes) click to toggle source

    # File lib/active_ldap/ldif.rb, line 21
    def normalize(attributes)
      result = {}
      attributes.each do |name, values|
        result[name] = Attribute.normalize_value(values).sort
      end
      result
    end