Welcome to my world of frustration, excitement, frustration, excitement and then back to frustration! I wouldn’t compare it to a roller coaster, because you’d always end up where you started. This relationship that I have with coding is like me on an escalator because you work your way up no matter how frustrating it is but get excited when you turn to look at how far you made it and then when you’re stagnant for a couple of days, the stairs move you back down!

The hardest part as with any project is getting started, at least for me! I think I went through 5 different ideas and started coding for 3 of them only to delete everything. My mistake was trying to think of something that is “useful”. At first I thought about scraping GlassDoor for job listings. In a perfect world, users would be able to view ruby programming jobs based on their location (state) and click on a link to apply. Unfortunately for me, GlassDoor was close to impossible to scrape so I checked out other websites like careerbuilder, monster, indeed, and snagajob but all were a waste of my time. Hey if you ended up scraping one of these websites, then I salute ya!

Then I said to myself, well, not everyone wants to apply to just any company! People are picky nowadays, and they want to work for a company that they’re passionate about. Companies are competing for talent, there’s no doubt about that. They all want to attract and retain the best people. I realized how much I already know about this because of my current role as a Customer Care Specialist for Great Place to Work, Inc. As a Customer Care Specialist, I’ve worked with thousands of companies who want to either get certified as a great place to work, or get recognition on one of our prestigious lists or both! This gave me the idea to scrape my company website for the Fortune 100 Best Companies to Work For list! Click here to see >> Fortune 100 List <<


I work in the Amazon cloud 9 environment which is amazing! I believe it’s free for a certain amount of time, possibly a year until they make you pay for it. I think it’s totally worth it! Learn has some detailed instructions on how to set and configure this. Why do I love it so much? Because it’s it’s on the cloud! I can access it from any computer or laptop no matter where I am and pick up where I left off. The AWS community is also great with supporting you with any questions that you have.

Here’s how you can set that up >>> How to set up your cloud 9 environment<<< and here’s how to configure it >>>Configuring AWS Cloud9 Local Environment<<<


Setting up my gem was fairly easy! All I did was type in

‘bundle gem [insert name of gem]’ and bundler created a directory for my gem! The next step was to create a git repository so that I can start committing. More info here on how to set up your gem >>>Set up your gem <<<

The name of my gem is called best_companies. I changed it a million times but stuck with this one because it’s simple and it resonates.


Text wrangler served as my coding diary throughout the entire process. I documented my thoughts, my frustrations, and my ideas which sometimes worked and sometimes didn’t. What I found useful was to type out my narration. For example, here is an actual excerpt from text wrangler featuring my first narration (don’t mind the typos):

“Welcome to BestCompanies!”
“Type “see list” to view the Fortune 100 Best Companies to Work For list”
“Type “see location” to see the list of companies by state”
“Type exit to exit to program”

**user types see list**

“Here are the list of best companies:”

**100 Best Companies List**
1. Google Inc.
Industry: Information Technology
Location: Mountain View, California
Review: No Review Available

(show all companies on the list…)

“Type “see list” to view the Fortune 100 Best Companies to Work For list”
“Type “see location” to see the list of companies by state”
“Type exit”

**User types “see location” to see list of companies by state**

“Please see the list of states below. Type in the number associated with the state to view Best Companies by State or type “main menu” to go back”
1. California
2. Missouri
3. Florida

**User types “1” for California**

1. Google, inc.
8. Salesforce,
6. Genentech,

“Please see the list of states below. Type in the number associated with the state to view Best Companies by State or type “main menu” to go back”

**User will then choose to go back to the main menu to view the companies again or type exit to leave the program**

So there you have it! After working through the narration and changing a few things around, I started planning what each class would be responsible for. Here are some below:

Scraper class

  • Responsible for scraping a website for companies on the list
  • It will create an array of company hashes that will include name, location, industry and review link if one is available.
  • Scrape the review links to create a “Ratings” and “Awards” hash.

  Company class

  • Responsible for instantiating new company instances
  • Every company should have a name, a website, location, industry, url, and ratings and rewards
  • A company class is responsible for keeping track of all of its companies
  • A company that does not have a review will only have a name, location, and industry
  • A company that has a review will have ratings and awards 

Location class

  • Responsible for instantiating location instances
  • A company will have one location but location can have many companies
  • Responsible for keeping track of all locations

Trust me when I say this will help you get started!

Every day after a long coding session, I would write in my text wrangler to set me up for the next coding session. It helped me pick up where I left off very quickly. Here is an example:

Great! I was able to eliminate redundant code in the CLI. I was able to add ratings only
for a company that the user is interested in but I still need to figure out how to display only that company’s information. Until next time….

Sometimes I would write in my text wrangler just to keep myself sane =)

I did itttt!!!!! My code works again!!!! wohooo!! Words cannot describe how much this
makes me happy!


When thinking about what classes to create, it helped me out a lot to think of how the classes will relate to one another, object relationships if you’re so inclined =). The first thing I did was repeat to myself “Every company has a location but a location has many companies” and “A company has an industry but an industry has many companies”. This was the same concept as the artist-song relationship where a song belongs to an artist and an artist has many songs!

After creating my classes, I started to see redundancy with my location(state) and industry classes. Both classes had similar class and instance methods so I placed the similar methods into a module and extended/included the modules within the classes. My code started to look better, cleaner! It was a proud moment for me!


Remember the part where I became frustrated? Well let me start by saying that since I started this project, the website changed TWICE. Yes! The first one was a structural change which caused me to rewrite my scraper class entirely. The second change was actually a good change. It wasn’t structural and consisted of content changes only, but that doesn’t mean it wasn’t conducive to an anxiety attack! To make things more interesting, after I heard about the website change, I decided it would probably be a good idea to record my reaction in a screen/video recording! code with me


Okay! Drum roll please! This is where it begins! I’m SOOO excited to show you what i’ve accomplished.

My gem allows a user to view the 2017 and 2018 Fortune 100 Best Companies to Work For list. Users will be able to view custom ranges in terms of ranks (1-100), view company ratings and awards, view states and industries, view companies by state or industry, switch lists by switching year, and adding companies to your archives for viewing later.


If the user types in ‘see list’, the entire list of best companies will appear along with the rank, year, industry, location and their review url.

What is a review url you ask? Well, when a company is a certified great place to work, they get a written review by Great Place to Work, Inc which contains employee ratings and awards along with other good stuff!

When the user type in a custom range like ‘1-3’ for example, the companies ranked 1-3 will appear.

Then users will be able to type in any rank like this: ‘rank 5’ to view the employee ratings and awards for that company. They can also save the company into their archives so that they can view it later.

Sometimes a company will have a review url listed but the url is not valid meaning it will take us to an error page. I came across this problem as I was scraping each company for the ratings and awards by using the review url as the argument in my scraper class. When it wasn’t scraping anything, I immediately knew it was the url. To solve this issue, I researched and found a gem called Faraday which tells you the status of a url. 200 means it’s valid and 404 means it’s an error page. I happily added this to my input validation method. So if a company doesn’t have a valid review url, the program will notify the user and ask them if they’d like to add the company into their archives anyway.

Remember when I mentioned object relationships? Users will be able to view companies by state and companies by industry! If the user types ‘see state’ a list of states will appear in alphabetical order.

Then proceed to type the number to the corresponding state. For example, type ‘1’ for California to view the companies on the list that is located there.

You can also do the same thing for industry. =) And after any point you see a company that you want to learn more about, just type in it’s corresponding rank and the ratings and awards for that company will appear if the review url is valid. Then it will ask you if you want to save to archives. Type archive to view your list of saved companies in the main menu.

I definitely learned a ton! An example would be how to separate and organize your methods! For me, I knew it made sense to have most of my prompts in the CLI class and so I made sure to organize them in a way that made the most sense to me. I also put myself in my user’s shoes and used the console a ton to test out my code. Also, binding pry will be your best friend!

That’s it! I hope that you enjoyed reading this blog as much as I had enjoyed working on this project! Leave a comment below to tell me what you think!

5 thoughts on “Best Companies – Command Line Interface Ruby Gem

  1. I blog quite often and I genuinely thank you for your content.
    The article has truly peaked my interest. I’m going to bookmark your site and keep checking for new
    information about once a week. I opted in for your RSS
    feed too.

  2. You’re so awesome! I don’t believe I’ve read anything like that before.
    So good to find another person with unique thoughts on this
    subject matter. Really.. many thanks for starting this up.
    This website is something that is needed on the internet, someone with some originality!

  3. This design is steller! You obviously know
    how to keep a reader amused. Between your wit and your videos, I was almost moved to start my
    own blog (well, almost…HaHa!) Wonderful job.
    I really loved what you had to say, and more than that, how you presented
    it. Too cool!

  4. Howdy! Would you mind if I share your blog with my zynga group?
    There’s a lot of folks that I think would really enjoy your content.
    Please let me know. Thank you

Comments are closed.