Method: Net::LDAP::Filter.eq

Defined in:
lib/net/ldap/filter.rb

.eq(attribute, value) ⇒ Object

#eq creates a filter object indicating that the value of a paticular attribute must be either present or must match a particular string.

To specify that an attribute is “present” means that only directory entries which contain a value for the particular attribute will be selected by the filter. This is useful in case of optional attributes such as mail. Presence is indicated by giving the value “*” in the second parameter to #eq. This example selects only entries that have one or more values for sAMAccountName:

f = Net::LDAP::Filter.eq( "sAMAccountName", "*" )

To match a particular range of values, pass a string as the second parameter to #eq. The string may contain one or more “*” characters as wildcards: these match zero or more occurrences of any character. Full regular-expressions are not supported due to limitations in the underlying LDAP protocol. This example selects any entry with a mail value containing the substring “anderson”:

f = Net::LDAP::Filter.eq( "mail", "*anderson*" )

– Removed gt and lt. They ain’t in the standard!



81
# File 'lib/net/ldap/filter.rb', line 81

def Filter::eq attribute, value; Filter.new :eq, attribute, value; end