I will make this quick. I'm using Ruby/LDAP to search using my base_dn criteria. I get a result back (of type Entry). I can convert object of type Entry to Hash with to_hash method. The problem is when the result is returned it is multiple objects of type Entry. I want to convert them to hash append them while looping. Look at this:
connection.search(base_dn,scope,filter) do |entry|
#pp entry.to_hash
searchResult.merge!(entry.to_hash)
end
You know if i am looping through and I would like to add objects to an array, I can use << and it will added it as it goes through. I read the RDOC, the merge or update method of hash should do similar but to no avail. Could someone give me a hint on how I can convert Entry objects to hash and appended.
The above code gives me the last entry in the search. It is basically overwriting searchResult hash every time rather than merging with the existing hash. Thanks in advance.