Function rb_sys::macros::TEST

source ·
pub fn TEST<T: Into<VALUE>>(obj: T) -> bool
Expand description

Emulates Ruby’s “if” statement.

@param[in] obj An arbitrary ruby object. @retval false obj is either ::RUBY_Qfalse or ::RUBY_Qnil. @retval true Anything else.

use rb_sys::special_consts::*;

assert!(!TEST(Qfalse));
assert!(!TEST(Qnil));
assert!(TEST(Qtrue));