Skip to main content

rb_define_const

Function rb_define_const 

Source
pub unsafe extern "C" fn rb_define_const(
    klass: VALUE,
    name: *const c_char,
    val: VALUE,
)
Expand description

Defines a Ruby level constant under a namespace.

@param[out] klass Namespace for the constant to reside. @param[in] name Name of the constant. @param[in] val Value of the constant. @exception rb_eTypeError klass is not a kind of ::rb_cModule. @exception rb_eFrozenError klass is frozen. @post Ruby level constant klass::name is defined to be val. @note This API does not stop you from defining a constant that is unable to reach from ruby (like for instance passing non-capital letter to name). @note This API does not stop you from overwriting a constant that already exist.

@internal

ยงAbove description is in fact inaccurate. This API interfaces with Ractors.

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