Embed mruby or Ruby interpreters into Crystal projects to use Ruby as a scripting language with similar syntax.
Anyolite is a Crystal shard that integrates a fully functional mruby or Ruby interpreter into Crystal, allowing Crystal classes and functions to be wrapped and exposed to Ruby. It enables Ruby to serve as a scripting language for Crystal applications, leveraging their syntactic similarities for seamless interoperability.
Crystal developers who want to embed Ruby as a scripting language in their applications, particularly for scenarios like game development (e.g., RPGs), configuration scripting, or extending functionality with user-defined scripts.
Developers choose Anyolite for its minimal boilerplate syntax, garbage collector safety, and flexibility in handling complex data types like structs and enums across languages, making it easier to bridge Crystal and Ruby compared to manual bindings.
Embedded mruby/Ruby for Crystal
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The README demonstrates wrapping a Crystal class with just a few lines using `Anyolite.wrap`, emphasizing 'easy syntax without unnecessary boilerplate code.'
Includes a simple system to prevent conflicts between Crystal and Ruby garbage collectors, ensuring safe cross-language memory management as highlighted in the features.
Supports objects, arrays, hashes, structs, enums, and unions as function arguments and return values, allowing complex data interchange without manual conversion.
Methods and constants can be excluded, modified, or renamed with annotations, providing fine-grained control over the Ruby interface as described in the features.
Offers options to compile Ruby scripts directly into the executable, enabling standalone distribution without external script files, a key feature mentioned in the README.
Requires installation of Ruby, Rake, Git, and a C compiler (GCC or MSVC), making the initial setup more involved than typical Crystal shards, as noted in the prerequisites.
Version 2.0.0 will introduce breaking changes to the API and build process, necessitating migration efforts, which is explicitly warned in the roadmap.
MRI support on Windows does not currently work, restricting the use of regular Ruby in Windows environments, as admitted in the roadmap's limitations.
Features like splat arguments, slices support, and bignum are on the wishlist but not yet implemented, limiting some Ruby functionalities for advanced use cases.