On Oct 30, 11:21 am, Brian Chapados <[EMAIL PROTECTED]> wrote:
> A couple issues here:
>
> 1. I think John is right in that the break is causing the problem,

Yeah, that was the culprit.

> 2. That loop is unnecessary.  Why create a hash and then not use it to
> lookup the props?

There's actually more code that follows, I only went as far as were
the error was, the rest of the code actually uses the hash :)

> 3. In ruby, there are a couple of different 'open' methods, if you use
> File.open(), '#each' will give you an iterator over each line. All of
> the methods in Enumerable are based on each, so you have lots of
> options for operating on lines.
> 4. Is you use CSV (suggested above) or FasterCSV, you can easily map
> names to the columns, which makes processing the data a bit easier.
>
> Here is a version of what I think you are trying to 
> do:http://gist.github.com/21093
>
> Take a look at this and read through the online api docs.  For this
> case, File, Array and Enumerable should get you pretty far.
>
> welcome to ruby!
> Brian

I did take a quick look at CSV and FasterCSV, but I was in a bit of a
hurry to get this done. With elections right around the corner, and
working for a paper, its pretty hectic. I'll look more into the link
you provided as soon as things calm down around here. Right now I've
got it working, some I'm going to leave it be till its immediate need
is over, then I'll revamp it for next time :-)

True, the data is not 'technically' CSV, but its become a bit of a
catch-all phrase in some circles, kind of like 'Kleenex' ;)

Thank you all for your help, guidance and tips.
--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to