/csv-to-tree

Primary LanguageRubyOtherNOASSERTION

Employee CSV Tree Parser

Your job is to use the .csv file in the data directory to construct a tree of employee hierarchy. The result should be a string, indented appropriately to show the hierarchy.

Examples

Employee Manager
Al Dente
Anne Teak Al Dente
Barb Dwyer Al Dente
Bill Ding Barb Dwyer
Chris Cross Barb Dwyer
Jay Walker
Joy Rider
Kenny Penny Joy Rider
Les Moore Kenny Penny
Lou Pole Joy Rider
M. Balmer Lou Pole
Sonny Day Lou Pole
Tim Burr Sonny Day

For the given set of data above, your final result should look like the following:

Al Dente
  Anne Teak
  Barb Dwyer
    Bill Ding
    Chris Cross
Jay Walker
Joy Rider
  Kenny Penny
    Les Moore
  Lou Pole
    M. Balmer
    Sonny Day
      Tim Burr

Extra

For an extra challenge, create an even more in-depth csv file and test your code.

Setup

  • Fork
  • Clone
  • Turn on TravisCI for the fork by visiting https://travis-ci.org/profile/, clicking the "Sync now" button and scrolling down to find the repository to build.
  • Create a new branch for your work using git checkout -b v1
  • Implement specs and code
  • Push using git push -u origin v1

Further Practice

This warmup can be completed multiple times to increase your comfort level with the material. To work on this from scratch, you can:

  1. Add an upstream remote that points to the original repo git remote add upstream git@github.com:gSchool/THIS-REPO.git
  2. Fetch the latest from the upstream remote using git fetch upstream
  3. Create a new branch from the master branch of the upstream remote git checkout -b v2 upstream/master
  4. Implement specs and code
  5. Push using git push -u origin v2

Each time you do the exercise, create a new branch. For example the 3rd time you do the exercise the branch name will be v3 instead of v2.