February 4 - Build a CSV File Parsing System in Ruby
This coding exercise will walk through how to work with CSV files and convert a file's content into Ruby collections that you can utilize.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
  • Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license

Summary

Build a CSV File parser in Ruby that converts a CSV file to array values.

Exercise Description

This coding exercise examines how to build a method that parses a CSV file, stores each line as an array, with each column as a separate element in the array.

Sample File

large

Example Data Output

[
  ["Name", "Title", "Email"],
  ["Darth Vader", "CEO", "betterthan@theforce.com"],
  ["Luke Skywalker", "Dev", "daddy@issues.com"],
  ["Kylo Ren", "COO", "daddy2@issues.com"],
]

Real World Usage

There are many times, when building a Ruby application, that you need to convert a large amount of data from a CSV file and utilize it in an application. This exercise will test your ability to:

  • Work with file paths
  • Convert string based data to arrays
  • Implement regular expressions for parsing data

Starter Code

Code File