Ruby support #1

Open
jaroslaw wants to merge 165 commits from ruby into main
Showing only changes of commit 04d8845729 - Show all commits

View file

@ -131,12 +131,14 @@ fn then(r_self: magnus::Value) -> magnus::Value {
let ruby = Ruby::get().unwrap(); let ruby = Ruby::get().unwrap();
promise promise
.clone() .clone()
.then(RubyValue::new(if ruby.block_given() { .then(RubyValue::new(
ruby.block_proc().expect("Failed to create Proc").as_value() if ruby.block_given() {
} else { ruby.block_proc().expect("Failed to create Proc")
ruby.proc_new(|ruby, _, _| ruby.qnil().as_value()) } else {
.as_value() ruby.proc_new(|ruby, _, _| ruby.qnil().as_value())
})) }
.as_value(),
))
.into_value() .into_value()
} }