Understanding TruffleRuby – the Ruby Truffle interpreter
TruffleRuby is a high-performance implementation of the Ruby programming language on GraalVM that is built on Truffle. In this section, we will explore some of the language-specific concepts, with code examples, to gain a good understanding of Ruby implementation on GraalVM.
Installing TruffleRuby
TruffleRuby, too, does not come by default with GraalVM installation. You'll have to download and install it using the Graal updater tool. To install TruffleRuby, use the following command:
gu install ruby
After installing Ruby, we have to run some post-install scripts to make OpenSSL
C extensions work. We need to run post_install_hook.sh
, which you will find under the ruby/lib/truffle
directory. Let's test the installation with a simple Ruby application:
print "enter a " a = gets.to_i print "Enter b " b = gets.to_i c = a + b puts "Result " + c.to_s
The preceding code...