Building My First Ruby Gem

Screenshot of my Wotd CLI Gem

As part of my Flatiron School Online Full Stack Development curriculum, I embarked on my first major project — Making my own RubyGem! The project specified we build a RubyGem that provides a command line interface to an external data source.

To be honest this project intimidated me at first, actually skipped it and have only now gone back to complete it. Note to other students who find themselves feeling overwhelmed or intimidated, don’t be….this project is fun! So far this has been my favorite assignment and it felt really good seeing my CLI gem work!! And watch Avi’s Daily Deal video walkthrough….it was most helpful!!!

First I needed an idea! After much deliberation, I decided to make a simple word of the day CLI. In a time of peak emoji and internet-speak usage, thought it might be nice to be reminded of real words!!

Next I needed to find an external data source. I choose to use Merriam-Webster’s website as my source. They do have an API but wasn’t sure I wanted to use it to generate random words every day. So I choose to scrape their word-of-the-day webpage.

Now it was time to start coding! Bundler made it very easy to make a gem from scratch. Bundler generates the foundation of the gem and basic structure. After that I started coding the interface and menu with fake data, then fake objects….eventually I coded the scraping methods and my data became real!

I have tested my gem over the past few days, to make sure it still works and yesterday Merriam-Webster decided to give two definitions instead of one….and it broke my program!! The definitions and examples are in the same div class, and my example was exacting the second definition. This is not what I wanted. So back to my scraping method….After some searching on StackOverflow I was able to extract the right data. I changed my definition scraping method to extract all ptag text between two specific sets of h2 tags. Now everything is running smoothly.

My Wotd gem is official and published on! It feels great seeing this project in action and with over 100 downloads! I would like to add some features, specifically audio for pronunciation…that will take some investigating on my part. As soon as I figure that part out, I will update this project! Stay tuned for future releases!

Check out my Wotd CLI gem on my github. Feel free to follow me on twitter! Thank you for reading and to other students, I hope you have fun with this project!!