[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: CSV ORM

Jon Egil Strand

1/5/2007 9:23:00 PM

2 Answers

Gregory Brown

1/5/2007 9:29:00 PM

0

On 1/5/07, Jon Egil Strand <jes@luretanker.no> wrote:
>
> Gregory and James
>
> Thank you so much for your precise and speedy replies, I am thankful both
> for your suggestions and for your effort in building these libraries.
>
> With FasterCSV I espescially like the ability to set
>
> :headers => "my;custom;header"

anything in :csv_options gets passed along to FasterCSV in the code I
suggested, so you might be able to see if that'll be helpful somehow.

James Gray

1/5/2007 11:42:00 PM

0

On Jan 5, 2007, at 3:23 PM, Jon Egil Strand wrote:

> -------------------------------------------------
> TO
> -------------------------------------------------
> people = Array.new
> FCSV(data, :col_sep => ";",
> :headers => true,
> :header_converters => :symbol ) do |csv|
> csv.each do |csvrow|
> people.push OpenStruct.new(csvrow.to_hash)
> end
> end
>
> people.each do |person|
> puts person.first_name
> end
> -------------------------------------------------
>
> Not meaning to bash your suggestion, just sharing my initial
> reaction. Any comments or caveats?

Your code looks just fine to me. Glad it helps!

James Edward Gray II