Using the Ruby Distribution

This page provides important information for users of the Ice for Ruby distribution.

On this page:

Overview of the Ice for Ruby Distribution

Ice for Ruby is available as a collection of Ruby gems. Each package provides the following components:

  • Ice extension for Ruby
  • Standard Slice files
  • Slice-to-Ruby compiler (slice2rb)

Installing the Ice for Ruby Distribution

Linux and macOS users can install Ice for Ruby using this command:

 sudo gem install zeroc-ice --version=3.6.5

This gem builds Ice for Ruby from source and supports Ruby 1.8 or later.

Windows users can install a binary gem instead:

gem install zeroc-ice-x64-mingw    (Windows 64-bit)
gem install zeroc-ice-x86-mingw    (Windows 32-bit)

These gems require Ruby 2.4.

Using Ice for Ruby

The installation process automatically adds the Ice modules to Ruby's package directory and adds the Slice-to-Ruby compiler (slice2rb) to a directory that's likely already in your executable search path. To verify that Ice is installed, execute these commands:

irb> require 'Ice'
irb> Ice::getSliceDir()

The output of getSliceDir shows where the standard Slice files have been installed.

Ruby 1.8

 Users of Ruby 1.8 must add the -rubygems option when starting the interpreter with irb or ruby:

irb -rubygems
irb> require 'Ice'
irb> Ice::getSliceDir()

The Ice manual provides a complete description of the Ruby mapping, including the options for generating Ruby code from Slice definitions.


Using the sample programs

Sample programs are provided in a separate GitHub repository. You can browse this repository to see build and usage instructions for all supported programming languages. Simply clone this repository and use its 3.6 branch:

git clone -b 3.6
cd ice-demos