CLI gem application — The Flatiron School.

Deirdre Sullivan
2 min readApr 27, 2020
it’s an app about cats!

I finally completed my CLI gem application for Learn Verified — marking the end of the Ruby curriculum for the Flatiron School. I approached it with a very pessimistic attitude, believing I would not be competent enough to finish the project on my own. I was pleasantly surprised when I realized midway to completion that I actually had a decent grasp on Ruby concepts. I did however, run into a few hurdles.

I wanted to make a CLI app that scraped www.cattime.com and take in all the cat breeds it listed as well as some basic characteristics of each breed. I found it relatively easy to scrape the main page for all of the breeds, but each breed and its characteristics have their own unique url. I had difficulty in redirecting the scraper class to go to that deeper level of the website and pull the information I wanted, but eventually I figured it out by building a second method in my Scraper class that utilized the instance methods defined in the Breed class.

Another problem I ran into was recursion. I was able to allow the user to request info about another cat, but when the program listed the cats in order again, the list numbers would increase indefinitely. I placed a condition on one of the Scraper class methods, atBreeds::Scraper.scrape_breeds if CatBreeds::Breeds.all.empty?. This fixed the list if the array was already full of the catbreeds. It prevented the program from scraping the same list again and put more cats into the array.

One final concept I slightly struggled with was controlling the index of the cat breeds array. I had no issue in adjusting the list of cats to start from 1 as opposed to 0, where the catbreeds array truly starts, but I had trouble adjusting the user’s input to match with the corresponding index number. I struggled to locate where I should control the index , but ultimately found a solution in attaching it to where the user inputs the breed number *i.e. get.chomp.to_i-1. Then, the input of the user matched the number of the cat they were seeking info about.

I enjoyed this experience for the most part, but as Avi said in an instructional video, “the most intimidating part of being a programmer is a blank file”. This was my first time building a project hands off, and I think it took me longer to get started building the app than actually coding it out. Once I finished the app I felt that the experience gave me a new sense of confidence in building programs by myself. It’s important to be comfortable with not knowing everything that is required to build something — it is more important to know the right questions to ask.

--

--