# Ruby

Ruby 3.4.0 - highlights / The Ruby Toolbox

  • Ruby 3.3’s YJIT: Faster While Using Less Memory / HN
  • Ruby 3.2 Production-ready YJIT & Regexp timeout
  • High-performance Ruby - Run your Ruby code faster on GraalVM’s Ruby implementation, TruffleRuby

  • Ruby Singleton Classes / HN - Ruby has elements of both the Python and Smalltalk solutions – like Python, Ruby allows methods to be added to any arbitrary instance, not just classes. Like Smalltalk, it does this with the addition of an additional class-like object. Unlike Smalltalk, the Ruby class-like object is not a parent of the class, it’s an attribute of the class.

see also

Pickaxes book

Install Ruby

If this happens:

Error: while executing gem (Gem::Exception) Unable to require openssl. install openSSL and rebuilt ruby (preferred) or use non HTTPs sources

Make sure openssl is available on the system and recompile ruby. With rbenv is as simple as doing rbenv install ruby_version.

using Rbenv - Ruby Environment does things on the fly by using shims to execute commands.

  • a directory of shims (~/.rbenv/shims) is inserted to the front of PATH.
  • The directory holds a shim for every Ruby command.
  • The operating system searches for a shim that matches the name of the command, which in turn passes it to rbenv, determining the Ruby version to execute.
  • rbenv-gemsets is the rbenv equivalent of gemsets

Latest can be installed with rbenv installer

$ rbenv init            # Set up rbenv in your shell.

$ rbenv install -l      # list of all Ruby versions that can be installed 
$ rbenv install 3.0.2
$ rbenv global 3.0.2     # activate version globaly for given user
# or:
$ rbenv local 3.1.2    # set the Ruby version for this directory

And finally, if wanted ruby version is not shown upgrade it

If the version you need is missing, try upgrading ruby-build:

  git -C /home/yves/.rbenv/plugins/ruby-build pull

other

  • using RVM
    • RVM overrides the cd shell command in order to load the current Ruby environment variables.
    • RVM comes with its own Ruby installation mechanism
  • Uru - Ruby on Windows Guides

see also

online

TroubleShooting

OpenSSL is not available. (ruby 3.0.2p107)

may be indirectely caused by require: libssl.so.1.1: cannot open shared object file caused by Ubuntu 22.04 switching to the version 3.0 of OpenSSL.

Written on May 29, 2019, Last update on July 13, 2024
ruby lang