Function rb_define_virtual_variable

Source
pub unsafe extern "C" fn rb_define_virtual_variable(
    name: *const c_char,
    getter: rb_gvar_getter_t,
    setter: rb_gvar_setter_t,
)
Expand description

Defines a global variable that is purely function-backended. By using this API a programmer can define a global variable that dynamically changes from time to time.

@param[in] name Variable name, in C’s string. @param[in] getter A getter function. @param[in] setter A setter function. @post Ruby level global variable named name is defined if absent.

@internal

§@shyouhei doesn’t know if this is an Easter egg or an official feature, but you can pass 0 to the third argument (setter). That effectively nullifies any efforts to write to the defining global variable.

Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3