Project

csv_hasher

0.0
No commit activity in last 3 years
No release in over 3 years
A simple gem to return arrays of hashes for a CSV file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

CSV Hasher

Build Status Gem Version

This is a useful utility to return arrays of hashes of a CSV input file instead of arrays of arrays supported by the CSV class of Ruby.

Installation

gem install csv_hasher

Usage

require 'csv_hasher'
arr_of_hashes = CSVHasher.hashify('path/to/csv/file')

By default the header column names are converted to keys of the hashes. These keys are Ruby Symbols spider cased. If you want the header values to remain as key Strings then use

arr_of_hashes = CSVHasher.hashify('path/to/csv/file', { original_col_as_keys: true })

If you want your own keys then pass your keys as a parameter.

arr_of_hashes = CSVHasher.hashify('path/to/csv/file', { keys: custom_keys })

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-awesome-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-awesome-feature)
  5. Create new Pull Request
  6. Relax and enjoy a beer