MRI

From Rosetta Code
Revision as of 20:38, 16 September 2011 by rosettacode>Kernigh (Describe Ruby versus MRI.)
MRI is an implementation of Ruby. Other implementations of Ruby.
<lang ruby>if RUBY_VERSION >= "1.9"
 p RUBY_ENGINE
 # => "ruby"
end</lang>

Matz's Ruby Implementation or MRI refers to the original Ruby interpreter by Yukihiro Matsumoto, the inventor of Ruby. Matz and contributors wrote the interpreter in C language; MRI is also known as C Ruby or CRuby, by analogy with CPython.

Other implementations of Ruby follow MRI. When an example on Rosetta Code works with Ruby 1.8.7, this can be MRI 1.8.7, or anything else that implements the same language.

  • Ruby 1.8.7 adds Array#permutation method. This means that MRI 1.8.7 has Array#permutation, and other implementations of Ruby 1.9.2 must also have Array#permutation.
  • MRI implements Array#sort with quicksort. Other implementations of Ruby might use different sorting algorithm.