Method: LDAP::Conn#search_with_limit

Defined in:
lib/active_ldap/adapter/ldap_ext.rb

#search_with_limit(base, scope, filter, attributes, limit, &block) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/active_ldap/adapter/ldap_ext.rb', line 60

def search_with_limit(base, scope, filter, attributes, limit, &block)
  if @@have_search_ext
    search_ext(base, scope, filter, attributes,
               false, nil, nil, 0, 0, limit || 0, &block)
  else
    i = 0
    search(base, scope, filter, attributes) do |entry|
      i += 1
      block.call(entry)
      break if limit and limit <= i
    end
  end
end