Project

oocsv

0.0
No commit activity in last 3 years
No release in over 3 years
A very dynamic object-oriented approach to CSV reading and writing. Unlike the stdlib csv library, this does not handle files. Use the various I/O libraries for that. This gem only handles reading and writing CSV strings. It adds a new struct, CSVEntry, that dynamically has its instance attribute accessor methods created and initialized.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

oocsv

Gem Version

A very dynamic object-oriented approach to CSV reading and writing.

Installation

RubyGems

$ gem install oocsv

Bundler

Add this line to the application's Gemfile:

gem('oocsv')

And then execute:

$ bundle

Usage

require 'oocsv'

str = <<EOF
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
EOF
# => "Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38\n"

ary = OOCSV.read(str)
# => [#<struct Struct::CSVEntry>, #<struct Struct::CSVEntry>]

print OOCSV.write(ary)
# Year,Make,Model,Length
# 1997,Ford,E350,2.34
# 2000,Mercury,Cougar,2.38

ary[0].to_s
# => "#<struct Struct::CSVEntry @Year=1997 @Make=Ford @Model=E350 @Length=2.34>"