Sha256: 8cc6a3ebfde3be23e1bdae650ea9b633a2b9d828e233ecfc8d8062004dba0db6

Contents?: true

Size: 376 Bytes

Versions: 134

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

134 entries across 134 versions & 4 rubygems

Version Path
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.49 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.48 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.47 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.46 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.45 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.44 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.42 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.41 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.39 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.38 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
harbr-0.1.37 vendor/bundle/ruby/3.2.0/gems/bundler-2.4.21/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
rubygems-update-3.5.3 bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
bundler-2.5.3 lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
rubygems-update-3.5.2 bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
bundler-2.5.2 lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt
rubygems-update-3.5.1 bundler/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt