LDAP URI SCHEMA (described in RFC2255).


A Default port of 389 for URI::LDAP.

An Array of the available components for URI::LDAP.

Scopes available for the starting point.

  • SCOPE_BASE - the Base DN

  • SCOPE_ONE - one level under the Base DN, not including the base DN and not including any entries under this

  • SCOPE_SUB - subtrees, all entries at all levels

Class Methods


Creates a new URI::LDAP object from components, with syntax checking.

The components accepted are host, port, dn, attributes, scope, filter, and extensions.

The components should be provided either as an Array, or as a Hash with keys formed by preceding the component names with a colon.

If an Array is used, the components must be passed in the order [host, port, dn, attributes, scope, filter, extensions].


uri ={:host => '',
  :dn => '/dc=example'})

uri =["", nil,
  "/dc=example;dc=com", "query", nil, nil, nil])


Creates a new URI::LDAP object from generic URI components as per RFC 2396. No LDAP-specific syntax checking is performed.

Arguments are scheme, userinfo, host, port, registry, path, opaque, query, and fragment, in that order.


uri ="ldap", nil, "", nil, nil,
  "/dc=example;dc=com", nil, "query", nil)

See also

Instance Methods

Returns attributes.

Setter for attributes val.

Private method to assemble query from attributes, scope, filter, and extensions.

Returns dn.

Setter for dn val.

Returns extensions.

Setter for extensions val.

Returns filter.

Setter for filter val.

Checks if URI has a path. For URI::LDAP this will return false.

Private method to cleanup dn from using the path component attribute.

Private method to cleanup attributes, scope, filter, and extensions from using the query component attribute.

Returns scope.

Setter for scope val.

Private setter for attributes val.

Private setter for dn val.

Private setter for extensions val.

Private setter for filter val.

Private setter for scope val.