How to merge multiple Variables (Hpricot::Elements)

S

Stephan Meier

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.

e.g:
(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:

eg:

while @col1data.size....

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

end

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,966
Members
47,516
Latest member
ChrisHibbs

Latest Threads

Top