I'm just getting started with Ruby and have very little programming
background, so hopefully this is a simple problem to solve.
I'm writing a program that takes a number of url's from all ready
existing webpages as an input (the number of these URL's can vary),
extracts some data from the these pages (such as links to pictures,
google maps data, etc...) then builds 2 new webpages based off this
extracted data. One page is the index with a list of links to the
second page which contains all my extracted data.
The way it works now is basically in one big loop. So my input URL's
are stored in an array, I pop the last element out of the array, send it
to the loop to extract data and generate HTML and so on until my array
of input URL's is empty.
During this loop I am only generating HTML for the Body of the webpages.
The beginning of each webpage is written prior to starting the loop and
the end of the webpages are written after the loop finishes.
This was working because the pre-body and post-body parts of my webpages
didn't need any of the extracted data from my input URL's - it was just
really basic HTML code. And the body of the webpages ONLY needed the
extracted data. This isn't the case anymore.
Long story short, I need to separate the data extraction from the web
page building and this is turning out to be harder than I thought since
the number of input URL's can change at any time.
What I want to do is extract all the data for all the input URL's first
and store that info somehow. Then use a webpage building method of some
kind to reference the extracted data and generate my webpages. That
seems simple enough, but because my list of input URL's is always
changing I'm not sure how to dynamically create the number of objects I
need to store the extracted info.
Any tips? Thanks in advance.
···
--
Posted via http://www.ruby-forum.com/.