From: Derek Cannon Date: 2010-04-18T19:21:07+09:00 Subject: Re: Elegant Solution to a Seemingly Simple Problem? > There are lots of ways to identify more precisely which part of the HTML > you want, using CSS selectors. Most easily, if the rows are inside > then seomthing like 'table#courses tr' could do it. Since my original post, I've been playing around with the code some more. I made a new way of getting courses that automatically filters out "non-course" rows. The code is: table = doc.css("tr").collect { |row| row.css(".dddefault").collect { |column| column.text.strip } } This way, "non-courses" appear as empty arrays. I still don't know how to neatly get rid of the empty arrays... I tried .compact! but that doesn't seem to work. >doc = Nokogiri::HTML(open(url)) >raw_course_list = doc.css("tr").collect { |row| > t_row = row.css("td").collect { |column| column.text.strip } > t_row.insert(2, "") if (t_row[1] == "TBA") >}.reject{ |i| i.size != 4 } Excellent example, I think this is much better than what I had earlier. I guess I could now replace your reject with i.empty?, right? PS - I changed raw_course_list to table to make it more readable. -- Posted via http://www.ruby-forum.com/.