/* * call-seq: * entry.to_hash => Hash * * Convert the entry to a hash. */ VALUE rb_ldap_entry_to_hash (VALUE self) { VALUE attrs = rb_ldap_entry_get_attributes (self); VALUE hash = rb_hash_new (); VALUE attr, vals; int i; Check_Type (attrs, T_ARRAY); rb_hash_aset (hash, rb_tainted_str_new2 ("dn"), rb_ary_new3 (1, rb_ldap_entry_get_dn (self))); for (i = 0; i < RARRAY (attrs)->len; i++) { attr = rb_ary_entry (attrs, i); vals = rb_ldap_entry_get_values (self, attr); rb_hash_aset (hash, attr, vals); } return hash; }