gem is a packaged Ruby application or library.we can install, remove, and query gem packages using the gem command.RubyGems is the name of the project that developed the gem packaging system and the gem command.For gem installation information use the command “gem environment”
RubyGems doesn’t store the library files directly in standard library search path. It adds the necessary gem packages to the library seach path as needed at run time.This means that RubyGems must be loaded before any gem libraries are accessable.The most direct way to make RubyGems available is to just require it in the source code:
To explicitly use a particular version of a library, you need to use the gem method. This method specifies the name of a gem package and the version you wish to have loaded.For example, suppose your application uses RedCloth, but needs a version of RedCloth in the 3.x series. You can include explcitly in your code:
gem ‘RedCloth’, ‘~> 3.0’
Bundler makes it easy to make sure that your application has the dependencies it needs to start up and run without errors. First, you declare these dependencies in a file at the root of your application, called Gemfile. After declaring your first set of dependencies, you tell bundler to go get them:
$ bundle install
Bundler will connect to rubygems.org (and any other sources that you declared), and find a list of all of the required gems that meet the
requirements you specified.