I am using search of Net::LDAP, the returned entry is something like this.
#<Net::LDAP::Entry:0x7f47a6491c00 @myhash= {:loginshell=>["/bin/bash"], :cn=>["M... R..."], :homedirectory=>["/mnt/home/m..."], :uid=>["m..."], :userpassword=>["{CRYPT}$1$3zR/C...$R1"], ... }> I tried to do the following, but failed.
(1)
e = entry.to_hash e.has_key? "uid" (2)
entry.has_key? "uid" The first error says "to_hash" undefined, the second "has_key" undefined. Then I really don't know how to do it, basically I want to find if "uid" is present and if so get its correspondent value.
Thank you very much for the tip.
BTW, it only responds to "entry.uid", but if the search key is provided as a string, how to do that? for example,
def get_value(key) if entry has key return key's value end end