Sha256: 8cc6a3ebfde3be23e1bdae650ea9b633a2b9d828e233ecfc8d8062004dba0db6

Contents?: true

Size: 376 Bytes

Versions: 143

Compression:

Stored size: 376 Bytes

Contents

use magnus::{function, prelude::*, Error, Ruby};

fn hello(subject: String) -> String {
    format!("Hello from Rust, {subject}!")
}

#[magnus::init]
fn init(ruby: &Ruby) -> Result<(), Error> {
    let module = ruby.<%= config[:constant_array].map {|c| "define_module(#{c.dump})?"}.join(".") %>;
    module.define_singleton_method("hello", function!(hello, 1))?;
    Ok(())
}

Version data entries

143 entries across 143 versions & 5 rubygems

Version Path
bundler-2.4.19 lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
rubygems-update-3.4.18 bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
bundler-2.4.18 lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt