Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

87 lines (70 sloc) 3.202 kb

MLB.rb Build Status Dependency Status

MLB.rb is a Ruby library for retrieving current Major League Baseball players, managers, teams, divisions, and leagues.


gem install mlb


Usage Examples

$ irb
>> require 'mlb'
>>                   # => "Arizona Diamondbacks"
>> MLB::Team.all.first.league                 # => "National League"
>> MLB::Team.all.first.division               # => "National League West"
>> MLB::Team.all.first.manager                # => "Bob Melvin"
>> MLB::Team.all.first.wins                   # => 82
>> MLB::Team.all.first.losses                 # => 80
>> MLB::Team.all.first.founded                # => 1998
>> MLB::Team.all.first.mascot                 # => nil
>> MLB::Team.all.first.ballpark               # => "Chase Field"
>> MLB::Team.all.first.logo_url               # => ""
>>     # => "Alex Romero"
>> MLB::Team.all.first.players.first.number   # => 28
>> MLB::Team.all.first.players.first.position # => "Right fielder"

Supported Ruby Versions

This library aims to support and is tested against the following Ruby implementations:

If something doesn't work on one of these interpreters, it should be considered a bug.

This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.

If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be personally responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.


MLB was built with the following tools:


Copyright (c) 2010 Erik Michaels-Ober. See LICENSE for details.

Jump to Line
Something went wrong with that request. Please try again.