DEV Community

Cover image for My first Ruby CLI project
yarvinh
yarvinh

Posted on

My first Ruby CLI project

I'm a Flatiron school student and as part of my curriculum, I had to make a CLI app for my final Ruby project. I had a lot of ideas but I wanted to do something about my favorite sport which is soccer. I wanted the app to have three topics: World Cup, Champion League and players. The app would allow users to type a soccer player's name and get all the information about the player: competitions won, titles and more. I had this idea because when I'm watching a game, sometimes I want to know more about a particular player or the stats of the team.

I created 3 Ruby classes: one for Champion league, one for World Cup, and one for players who won Ballon d'Or. I decided to scrap the data because I couldn't find a good API about soccer. I finished my app but I didn't like it. I thought it was too plain and boring. So I asked myself: what can I do with this data? How can I turn this into a different app? I came up with a new idea to create a 10 question multiple choice quiz about soccer.

Methodology

I built a scraper class that was responsible for getting the data from the web. I used 3 different urls. I built methods to scrap data and three class methods to turn the data into object. I also built a class CLI responsible for printing all multiple choice question and logic to process the questions. It lets users know if they got the answer right or wrong and gives a choice to repeat the quiz.

What did I learn?

I learned more about scraping. How to get the data I want. I had a hard time with some gems. I learn a lot about how gems can help to improve an app. Every tool is out there to help your app. For example, if you work as a Mechanic and there is nut or bolt that you can't reach, you'll probably ask yourself why can't they make a better wrench to get this nut or bolt. But guess what? That tool is already out there but you don't know. Programming is the same way. I also learned how to take advantage of regular expressions. In this project, I got stuck a lot of times but the good thing is that it helped me learn how read every error and I improved my debugging skills.

Future plans

I have plans to make this app better because I know that people who love soccer will like it. Some of my friends who love soccer took the quiz and they love it. In the future I will give it a better design, and more questions options. The more I learn the more ideas will come to me.

Top comments (1)

Collapse
 
mabelm1 profile image
MabelM1

Great Article!