My opinion is that this issue is better addresses on an application specific basis using a custom converter:
#!/usr/bin/env ruby -wKU
require "rubygems"
require "faster_csv"
EXAMPLE = <<END_CSV
one,two,
1,2,3
END_CSV
p FCSV.parse( EXAMPLE,
:headers => true,
:header_converters => lambda { |h| h ? h.to_sym : :unknown } )
__END__
I'm willing to hear other opinions though.
James Edward Gray II
|