Handling CSV Data
CSV is a very common format for representing tabular data. It is an easily parsable data format to work with and it can be opened in all common spreadsheet applications, such as Microsoft Office and Google Docs, with no need for conversion.
We can represent columns and rows with CSV, much like a relational database or a spreadsheet, which makes it a very handy tool for processing exported database records, generating data to be imported into a database, or creating spreadsheets.
Ruby comes with a full library for handling CSV data out of the box. The Ruby CSV library is actually a gem and is part of the Ruby default gem set. This means that to use the CSV library in your code, you simply need to "require" it.
We can see the csv
gem with the following gem list
command:
$ gem list | grep csv csv (default: 1.0.0)
Ruby has even published this gem publicly on GitHub (https://packt.live/35qKCUf), just like any other gem.
All modern versions of...