Method: Bundler::URI::LDAP.build
- Defined in:
- lib/bundler/vendor/uri/lib/uri/ldap.rb
.build(args) ⇒ Object
Description
Creates a new Bundler::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]
.
Example:
uri = Bundler::URI::LDAP.build({:host => 'ldap.example.com',
:dn => '/dc=example'})
uri = Bundler::URI::LDAP.build(["ldap.example.com", nil,
"/dc=example;dc=com", "query", nil, nil, nil])
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/bundler/vendor/uri/lib/uri/ldap.rb', line 74 def self.build(args) tmp = Util::make_components_hash(self, args) if tmp[:dn] tmp[:path] = tmp[:dn] end query = [] [:extensions, :filter, :scope, :attributes].collect do |x| next if !tmp[x] && query.size == 0 query.unshift(tmp[x]) end tmp[:query] = query.join('?') return super(tmp) end |