MRuby examples to demonstrate usage.
Make sure to have MRuby installed, see here.
If you are on Linux chances are MRuby is already in the package repositories of your favorite distro! then you'll need to use your distro specific package manager to install it. E.g:
APT:
sudo apt install libmruby-dev
DNF:
sudo dnf install mruby-devel
Pacman:
sudo pacman -S mruby
That will install all the development headers needed to use MRuby.
In the root of this repo:
mkdir build && cd build
cmake ..
make
Examples included here:
- hello-world/
Simple hello world - hello-file/
Load ruby code from a file - pushing-variables/
Push various datatypes to Ruby land - objects/
Create classes/objects from C - checking-for-methods/
Try to find methods in Ruby land - call-methods/
Calling methods in Ruby land from C land - using-cdata/
Encapsulate C-data in a ruby object - kwargs/
Parse keyword arguments - blocks/
Use blocks from various ways
Credits where due, here are some helpful articles/post/resources that helped me to learn how to use MRuby:
All the examples found here are licensed under the MIT license.