From: Gregory Brown Date: 2006-12-18T03:11:18+09:00 Subject: Re: Grabbing data off a webpage On 12/17/06, Peter Szinek wrote: > Hi Bill, > > How about: > > require 'rubygems' > require 'open-uri' > require 'hpricot' > require 'enumerator' > > Record = Struct.new("Record", :id, :title, :author, :book_level, :points) > records = [] > > cells = > Hpricot(open('http://yorkcountyschools.org/mves/arlist/3-3.4.htm'))/"/html/body/table/tbody/tr//td" > > > cells.map { |elem| elem.inner_html }.each_slice(5) do |slice| > records << Record.new(*slice) > end clever solution peter. If you wanted to adapt this to use Ruport instead of a Struct (and get the features I showed) Try: records = [].to_table([:id, :title, :author, :book_level, :points]) and then replace the appending code with records << slice This would allow struct-like, hash-like, and array-like access as well as access to Ruport's data manipulation and formatting tools.