blob: b3112839972003aefe185a962652c5885588b00d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
use magnus::{define_module, function, prelude::*, Error};
fn hello(subject: String) -> String {
format!("Hello from Rust, {}!", subject)
}
#[magnus::init]
fn init() -> Result<(), Error> {
let module = <%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>;
module.define_singleton_method("hello", function!(hello, 1))?;
Ok(())
}
|