Ok what I need is a little weird and goes as follows:
Clues array is created manually, Data array is created dynamically. An Xpath function takes our clues as input and maps the results to data to create a dynamic array
clues = Array.new
clues << 'Power supply type'
clues << 'Slots'
clues << 'Software included'
selector = "//td[text()='%s']/following-sibling::td"
data = Array.new
data = clues.map do |clue|
xpath = selector % clue
[clue, doc.at(xpath).text.strip]
end
The code in the data array uses two inputs, clues and selector
every item at clues[index] goes into selector at %s to become
//td[text()='%s']/following-sibling::td
//td[text()='Power supply type']/following-sibling::td
//td[text()='Slots']/following-sibling::td
//td[text()='Software included']/following-sibling::td
Xpath then goes off and grabs information from a webpage using our stored commands, all of this is then stored as elements in the array data as data[0]…data[3]
Data[2] looks like this, a big chunk of information
Symantec Norton Internet Security (60 days live update); Recovery partition (inc
luding possibility to recover system; applications and drivers separately); Opti
onal re-allocation of recovery partition;
I want to take each piece of software listed here and store it on its own e.g.
data[2]Symantec Norton Internet Security (60 days live update);
data[3]Recovery partition (including possibility to recover system;
data[4]Optional re-allocation of recovery partition;
So I assume I need to split data[2] somehow and add it back into the data array?
I am trying to isolate this particular index as I need it on multiple lines for my final output to spreadsheet
Final Desired output

Output (indented to be more readable):