On Sun, Jan 28, 2018 at 5:48 PM, Shane Curcuru <[email protected]> wrote:
> I don't remember where .find() is
> declared, but ldap.rb line 650 defines [] like so:

find is defined in the common ASF::Base class for LDAP objects.  As
such, it is fairly dumb (as in: not knowledgeable about the semantics
of each of the subclass)

Unfortunately, after quite a bit of code was written, I discovered
that wanting to know if the Person/Committee/whatever actually existed
was a common need (who'd a thunk it... DOH!); but changing the
behavior of find at that point would break an unknown amount of code.

A common idiom in Ruby is to use indexing operators to find an object
of that type.  And indexing operators generally return nil if not
found.

Perhaps it would be a good thing to see if it there are calls to find
that would be better suited to use [] instead.  In the process we
could mark the ones that should remain find.  One hesitation: by
necessity, [] is slower than find, at least for the first call.  After
that point, the data is cached.

- Sam Ruby

Reply via email to