Sha256: da893b23b1bc69b2bd940e9c5c34a905fff054288c3cdd0ab6b54d6dc4f3a65e
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
= csv-hash Will import a CSV as an array of hashes. Or will export a CSV from an array of hashes (if given a column list). == Usage === Parse a csv to an array of hashes array_of_hashes, columns = CSVHash('path_to_csv.csv') Note the hash will have strings for keys and will remove all surrounding whitespace === Generate a string from an array of hashes and a column list string = CSVHash(array_of_hashes,[:column,"names","in",:order]) === Nested Hashes csv-hash supports nested hashes. A column tree of the structure (note the double underscore): one,two__foo,two__bar__three,two__bar__four 1, 2, 3, 4, will generate: { 'one' => '1', 'two' => { 'foo' => '2', 'bar' => {'three' => '3', 'four' => '4'} } } == Todo * Remove dependency on Fast CSV * Support auto column generation * Generate hash of arrays * Turn into CSVHash object which contains column structure and other metadata * Sequel integration * Arbitrary model support == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Tal Atlas. See LICENSE for details.
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
csv-hash-0.1.3 | README.rdoc |
millisami-csv-hash-0.2.0 | README.rdoc |
millisami-csv-hash-0.1.2 | README.rdoc |