Skip to content

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

License

Notifications You must be signed in to change notification settings

elifoster/oocsv-rb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>"

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages