This crate provides:
- An embeddable Ruby interpreter, which can be created with the
- A Rust and Ruby implementation of Ruby Core and Standard Library using high-quality Rust dependencies and modern Ruby.
- Support for injecting Rust code and types into the interpreter with a
- The ability to disable parts of the interpreter VM or library functions at
compile time. For example, deny access to the system environ by disabling
You can create an interpreter and begin executing code on it:
use artichoke::prelude::*; let mut interp = artichoke::interpreter()?; let result = interp.eval(b"2 + 5")?;
Artichoke supports calling Ruby functions from Rust and converting between Ruby boxed values and Rust native types:
use artichoke::prelude::*; let mut interp = artichoke::interpreter()?; let s = interp.convert_mut("💎"); let codepoint = s.funcall(&mut interp, "ord", & /* args */, None /* block */)?; let codepoint = codepoint.try_into::<u32>(&interp)?; assert_eq!(128142, codepoint);
All features are enabled by default.
The features exposed by this crate are unstable. Please refer to the
documentation in the source
Detect if Ruby code parses successfully.
A “prelude” for users of the
A REPL (read–eval–print–loop) for an Artichoke interpreter.
Artichoke CLI entry point.
Create a new Artichoke Ruby interpreter.