Ruby support #1
1 changed files with 8 additions and 6 deletions
|
|
@ -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() {
|
||||||
|
ruby.block_proc().expect("Failed to create Proc")
|
||||||
} else {
|
} else {
|
||||||
ruby.proc_new(|ruby, _, _| ruby.qnil().as_value())
|
ruby.proc_new(|ruby, _, _| ruby.qnil().as_value())
|
||||||
.as_value()
|
}
|
||||||
}))
|
.as_value(),
|
||||||
|
))
|
||||||
.into_value()
|
.into_value()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue