Han Lee
2 min readJun 22, 2016

A CLI gem for listing MLB batting leaders

This is an app packaged in a Ruby gem, allowing users to check current MLB batting leaders through a command line interface. To use this app, you just need to install a Ruby gem, batting_leaders, by typing “gem install batting_leaders” into your terminal, and run “batting_leaders”.

Let’s say you are curious about who are the leading batters in MLB for batting average today. You can type batting_leaders in your terminal, and it will give you a list of the current MLB batting leaders. If you are interested in seeing more info on a player in the list, you can type the number of the player in the list, and the app will show you more info on the player, such as its team and RBI.

Go Cubs!

The data used for this app was scrapped from espn.go.com/mlb/ using open-url and nokogiri. If you’d like to contribute to this app, you are very welcome to check my source code at my github account.