Skip to content

Ruby

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language with support for multiple programming paradigms, including functional, object-oriented, and imperative. It also has a dynamic type system and automatic memory management.

Ruby is available as a module on Apocrita.

Usage

The ruby module provides two main binaries:

  • ruby - The Ruby language
  • gem - The package manager for Ruby

ruby help option:

module load ruby
ruby --help

ruby man page:

module load ruby
man ruby

gem help option:

module load ruby
gem --help

RubyGems

The RubyGems software allows you to easily download, install, and use ruby software packages. The software package is called a gem and contains a packaged Ruby application or library.

Installing a Ruby package using gem

Gems can be installed via the gem install command:

gem install <package_name>

Your gem package will be installed under $HOME/.local/share/gem/ruby/X.Y.Z/gems, where X.Y.Z is the version of Ruby loaded into the environment.

If you would like to change the location where your Ruby gems are installed to, set the GEM_HOME variable before running the gem install command. For example, to install Gems into $HOME/gems, use the following commands:

module load ruby
export GEM_HOME=$HOME/gems
gem install <package_name>

Listing installed gems

This command will list all the locally installed Ruby gems.

gem list

More information about the gem package management tool can be found here.

References