Oh yes. Good question. Why would anyone want to implement a LDAP Server? Besides the fact the OpenLDAP is a pain to set up and isn't really rewarding in terms of perfomance, there are situations demanding LDAP Access to data residing in some kind of RDBMS. And that's my motivation.

After seriously thinking about doing it all by myself, I plugged in Google to get some answers. And there is ruby-ldapserver, hosted at rubyforge. Unfortunately. the project seems pretty dead, nevertheless the Alpha 0.3.1 Version released there works fine, although without SASL support, only simple ( plain bind ) works. 

How to use it? It's very straightforward. Download the package, see that it's in your path, and ready to rock. The package includes a few examples, showing off the beauty of the lib and ruby. That is how you implement a fully working LDAP Server ( okay, doing nothing, but works. )

class MyLdapOperations < LDAP::Server::Operation
  def search(basedn, scope, deref, filter)
    puts scope
    puts basedn
    puts deref
    puts filter[1]
  def simple_bind(version,dn,password)
    puts "Auth: #{dn} + #{password}"
    puts version
s = LDAP::Server.new(
	:port			=> 1234,
	:nodelay		=> true,
	:listen			=> 10,
#	:ssl_key_file		=> "key.pem",
#	:ssl_cert_file		=> "cert.pem",
#	:ssl_on_connect		=> true,
	:operation_class	=> MyLDAPOperations

You launch it, and it works. Certainly worth giving it a try, and a good piece to start if you want to get involved in the OS community.