Method: Net::LDAP#replace_attribute

Defined in:
lib/net/ldap.rb

#replace_attribute(dn, attribute, value) ⇒ Object

Replace the value of an attribute. #replace_attribute can be thought of as equivalent to calling #delete_attribute followed by #add_attribute. It takes the full DN of the entry to modify, the name (Symbol or String) of the attribute, and the value (String or Array). If the attribute does not exist, it will be created with the caller-specified value(s). If the attribute does exist, its values will be discarded and replaced with the caller-specified values.

Returns True or False to indicate whether the operation succeeded or failed, with extended information available by calling #get_operation_result. See also #add_attribute and #delete_attribute.

dn = "cn=modifyme,dc=example,dc=com"
ldap.replace_attribute dn, :mail, "newmailaddress@example.com"

936
937
938
# File 'lib/net/ldap.rb', line 936

def replace_attribute dn, attribute, value
  modify :dn => dn, :operations => [[:replace, attribute, value]]
end