Gems
Published Jul 30, 2021Updated Oct 14, 2022
Contribute to Docs
Gems are open-source Ruby libraries or applications that lend extra utility to other Ruby programs. Each gem is composed of the following:
- The source code it was built with (including any tests).
- Any documentation with metadata such as the name, version, and platform.
- A
.gemspec
file holding all gem-related metadata.
Gems can be referenced, installed, and published from an online registry called RubyGems.
To install gems to the local machine:
gem install name-of-gem
A list of previously installed gems is displayed with the following command:
gem list
Some popular Ruby gems include:
- Ruby on Rails for building robust, full-stack web applications.
- Active Record for object-relational database management in Rails.
- Pry for REPL-style inspection of programs at runtime.
- OmniAuth for third-party authentication in applications.
- Sinatra for a building relatively minimal, light websites.
Gems can be represented in a Gemfile
either in general or with a specific version:
source 'https://rubygems.org'gem 'pry'gem 'rails', '3.0.0.beta3'gem 'omniauth', '>=1.0'
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.