Anyolite is a Crystal shard which adds a fully functional mruby (or even regular Ruby) interpreter to Crystal.


Release ReleaseDate



Anyolite allows for wrapping Crystal classes and functions into Ruby with little effort. This way, Ruby can be used as a scripting language to Crystal projects, with the major advantage of a similar syntax.

Useful links for an overview:



You need to have the following programs installed (and in your PATH variable, if you are on Windows):

Using regular Ruby instead of mruby

It is possible to use Anyolite with regular Ruby (MRI) instead of mruby. An instruction to install MRI can be found at Using Ruby instead of mruby in the wiki.


Put this shard as a requirement into your shard.yml project file and then call

shards install

from a terminal or the MSVC Developer Console (on Windows).

Alternatively, you can clone this repository into the lib folder of your project and run

rake build_shard

manually to install the shard without using the crystal shards program.

If you want to use other options for Anyolite, visit Changing build configurations in the wiki.

How to use

Imagine a Crystal class for a really bad RPG:

module RPGTest
  class Entity
    property hp : Int32

    def initialize(@hp : Int32)

    def damage(diff : Int32)
      @hp -= diff

    def yell(sound : String, loud : Bool = false)
      if loud
        puts "Entity yelled: #{sound.upcase}"
        puts "Entity yelled: #{sound}"

    def absorb_hp_from(other : Entity)
      @hp += other.hp
      other.hp = 0

Now, you want to wrap this class in Ruby. All you need to do is to execute the following code in Crystal (current commit; see documentation page for the version of the latest release):

require "anyolite"

Anyolite::RbInterpreter.create do |rb|
  Anyolite.wrap(rb, RPGTest)


Well, that's it already. The last line in the block calls the following example script:

a = 20)
a.damage(diff: 13)
puts a.hp

b = 10)
a.absorb_hp_from(other: b)
puts a.hp
puts b.hp
b.yell(sound: 'Ouch, you stole my HP!', loud: true)
a.yell(sound: 'Well, take better care of your public attributes!')

The example above gives a good overview over the things you can already do with Anyolite. More features will be added in the future.


See Limitations and solutions in the Wiki section for a detailed list.

Why this name?

In short, it is a rare variant of the crystalline mineral called zoisite, with ruby and other crystal shards (of pargasite) embedded.

The term 'anyoli' means 'green' in the Maasai language, thus naming 'anyolite'.


Upcoming releases

Currently none

Later releases

Wishlist, entries might not be possible to implement