# File lib/ldap/ldif.rb, line 546
    def to_ldif( dn )
      ldif = "dn: %s\n" % dn

      # TODO: Need to dynamically assemble this case statement to add
      # OpenLDAP's increment change type, etc.
      case mod_op & ~LDAP_MOD_BVALUES
      when LDAP_MOD_ADD
        ldif << "changetype: add\n"
      when LDAP_MOD_DELETE
        ldif << "changetype: delete\n"
      when LDAP_MOD_REPLACE
        return LDIF.mods_to_ldif( dn, self )
      end

      ldif << LDIF.to_ldif( mod_type, mod_vals )
      LDIF::Mod.new( ldif )
    end