CompactCSV
CompactCSV is memory efficient csv module for ruby. Reading operations are compatible with default CSV module.
However, operations which change fields/values structure of row are not available in CompactCSV. If you want to do this, please use default CSV module.
Installation
Add this line to your application's Gemfile:
gem 'compact_csv'
And then execute:
$ bundle
Or install it yourself as:
$ gem install compact_csv
Usage
csv = CompactCSV.read('sample.csv', headers: true)
csv.each do |row|
p row # => #<CompactCSV::Row "ID":"1" "VALUE":"A">
row['VALUE'] = 'AAA'
p row # => #<CompactCSV::Row "ID":"1" "VALUE":"AAA">
end
Links
- ruby default CSV module: https://github.com/ruby/ruby/blob/trunk/lib/csv.rb
Contributing
- Fork it ( http://github.com/rnakano/compact_csv/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request