Josh Cheek wrote in post #963735:
> On Wed, Nov 24, 2010 at 4:39 PM, Phil H. <henleyphil / yahoo.com> wrote:
>
>> The way it works now is basically in one big loop.  So my input URL's
>> really basic HTML code.  And the body of the webpages ONLY needed the
>> 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/.
>>
>>
> Hi, I don't really see why the number of URLs changing is causing you
> problems. This should be in a loop, as you said, and a loop will iterate
> over all of them regardless of their size.
>
> I can understand the appeal of separating extraction of data from
> building
> of data, but in this case, I think that storing it in an intermediate
> form
> is unnecessary. I would suggest simply doing these steps one after the
> other. First extract all data, then build the page. Then you don't need
> to
> save it in a file and go run a second script to read it in and do stuff
> with
> it.
>
> I don't know what you are trying to do with this data, but here is an
> example https://gist.github.com/714817 It iterates over an array of
> URLs,
> opens those pages, pulls all the links out of them, then builds an html
> document where each page is displayed in a paragraph with a link to the
> page
> followed by an unordered list of all the links that page contains. No
> storing in files necessary.

Thanks for the response.  The reason I want to approach it this way is
because I've added another element to the webpages I'm creating which
requires JavaScript... Basically the webpages will need to be a bit more
complicated.   This messes up my original approach because I can't just
generate body of the HTML from the top down like I used to.  The dynamic
content of the webpages now needs to be mixed with static content where
as before the dynamic content was isolated to the body of the webpages,
so
I could write everything before and after the body outside of the loop
since it didn't require dynamic content I was extracting from my input
urls.  That way I wasn't re-writing a bunch of static HTML every
iteration of the loop... Hopefully that makes sense.

So if I continue with my current approach I would need to be able to
jump around to different parts of the webpages as they are being written
to avoid re-writing the static HTML..  I know that could probably be
done somehow, but I was hoping I could just avoid that by separating the
data
extraction and page building processes.

-- 
Posted via http://www.ruby-forum.com/.