Gems

Codecabulary Home / Learn Ruby / Gems

Gems are Ruby's implementation of libraries--reusable chunks of code.

As you build programs, you'll find yourself reusing certain bits of functionality. Often, these can become gems.

Other developers can then download your gems via RubyGems, using the RubyGems' Command Line Interface. Here's an example command, which downloads and installs the gem Rails.

	gem install rails
	

Simple, no? The RubyGems CLI queries RubyGems.org for a gem matching the name "rails." In this case, it will find the Rails framework and download it. For obvious reasons, your gem cannot share the name of another gem.

Look here for more RubyGem CLI commands.