This commit is contained in:
Jaroslaw Konik 2025-05-15 17:39:07 +02:00
parent 9b8b15ded7
commit 04d8845729

View file

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