I am very new to ruby so excuse me if this is a basic question.
I have a list that looks like this:
[name, max, john, raj, sam]
And i want to make a new array that will look like this:
[[name, max], [name, john], [name, raj], [name, sam]]
Here is what i am trying to do:
row.xpath('td').each_with_index do |cell, index|
if index == 0
tarray['name'] << cell.text
else
tarray['values'] << cell.text
end
I know i am doing it wrong because when i have ['name'] it will not be logically possible to have ['values'] Please advice me on how i can achieve this using the best method.