[Ruby-activeldap-discuss] LDIF Sort?
MR-Mencel at wiu.edu
Wed Jun 18 17:47:55 EDT 2008
I can get the data I want out of the LDIF, put it into an array, and sort it like this...
old_ldif_data = ''
File.open(old_file, "r") do |f|
old_ldif_data = f.read
old_ldif_obj = ActiveLdap::Ldif.parse(old_ldif_data).each do |record|
old_arr << [[record.attributes["uid"],record.attributes["wiuRegisteredStar"]]]
old_arr.sort.each do |entry|
Didn't know if there was a way to do this with the LDIF object itself rather than putting the data into an array and then sorting it, and whether it would be faster.
My ultimate goal is this.... Grab two LDIF files, read the data in to sorted LDIF objects, merge sort the two LDIF objects so I can compare changes from yesterday's file to today's and do some action depending on whether a user entry is new, is removed, or is changed.
----- Original Message -----
From: "Matt Mencel" <MR-Mencel at wiu.edu>
To: ruby-activeldap-discuss at rubyforge.org
Sent: Wednesday, June 18, 2008 3:49:56 PM GMT -06:00 US/Canada Central
Subject: [Ruby-activeldap-discuss] LDIF Sort?
Is there a way to sort LDIF data after it's been read in from a file? Sort by dn, uid, or some other given attribute?
Ruby-activeldap-discuss mailing list
Ruby-activeldap-discuss at rubyforge.org
More information about the Ruby-activeldap-discuss