Forum: Ruby How to merge multiple Variables (Hpricot::Elements)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Stephan M. (Guest)
on 2009-02-08 13:03
Hey List,

i hpricot a website (Html Table) and want to normalize the data
For now i have about five variables with all the data of one column.

(HTML Source)
col1 :: col2 :: col3
data1a :: data2a :: data3a
data1b :: data2b :: data3b
data1c :: data2c :: data3c

each column is hold in on variable (@col1data, @col2data...), and i have
a while loop to "merge" the data to a new model:


while @col1data.size....

model =
model.col1 = @col1data.shift.inner_text
model.col2 = @col2data.shift


So i get three Models with the expected data.

But this is so damn ugly ;)

How can this be done without shift?

Thanks for your time!
This topic is locked and can not be replied to.