What's your preferred method and code for looping through source files? Essentially, each row within my source file represents a bunch of variables I want to use - whether they be various usernames/passwords for login; information on various fields on my screen I want to assert; etc.
I've used the following (once) previously with success, but I don't feel it's the optimal code. Surely there's an easier, simpler way within Ruby? Problem is I'm just trying to learn. userpass_file = IO.readlines('xxx_INPUT_FILE_xxx') i = 1 #start on second line (line 1), the first line (line 0) is column headings while i < userpass_file.length do array = CSV.parse_line(userpass_file[i]) varable1 = array[0] variable2 = array[1] variable3 = array[2] DO YOUR STUFF WITH THE VARIABLES i = i +1 #increment for the next line end Maybe the CSV parser will do a better job??? (My source file is currently a CSV if that helps.) - Jason _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general