Ruby  3.4.0dev (2024-11-05 revision 348a53415339076afc4a02fcd09f3ae36e9c4c61)
Functions
variable.h File Reference

(348a53415339076afc4a02fcd09f3ae36e9c4c61)

Public APIs related to names inside of a Ruby program. More...

#include "ruby/internal/attr/nonnull.h"
#include "ruby/internal/attr/noreturn.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/st.h"
Include dependency graph for variable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

VALUE rb_mod_name (VALUE mod)
 Queries the name of a module. More...
 
VALUE rb_class_path (VALUE mod)
 Identical to rb_mod_name(), except it returns #<Class: ...> style inspection for anonymous modules. More...
 
VALUE rb_class_path_cached (VALUE mod)
 Just another name of rb_mod_name. More...
 
void rb_set_class_path (VALUE klass, VALUE space, const char *name)
 Names a class. More...
 
void rb_set_class_path_string (VALUE klass, VALUE space, VALUE name)
 Identical to rb_set_class_path(), except it accepts the name as Ruby's string instead of C's. More...
 
VALUE rb_path_to_class (VALUE path)
 Identical to rb_path2class(), except it accepts the path as Ruby's string instead of C's. More...
 
VALUE rb_path2class (const char *path)
 Resolves a Q::W::E::R-style path string to the actual class it points. More...
 
VALUE rb_class_name (VALUE obj)
 Queries the name of the given object's class. More...
 
VALUE rb_autoload_load (VALUE space, ID name)
 Kicks the autoload procedure as if it was "touched". More...
 
VALUE rb_autoload_p (VALUE space, ID name)
 Queries if an autoload is defined at a point. More...
 
VALUE rb_f_trace_var (int argc, const VALUE *argv)
 Traces a global variable. More...
 
VALUE rb_f_untrace_var (int argc, const VALUE *argv)
 Deletes the passed tracer from the passed global variable, or if omitted, deletes everything. More...
 
VALUE rb_f_global_variables (void)
 Queries the list of global variables. More...
 
void rb_alias_variable (ID dst, ID src)
 Aliases a global variable. More...
 
void rb_free_generic_ivar (VALUE obj)
 Frees the list of instance variables. More...
 
VALUE rb_ivar_get (VALUE obj, ID name)
 Identical to rb_iv_get(), except it accepts the name as an ID instead of a C string. More...
 
VALUE rb_ivar_set (VALUE obj, ID name, VALUE val)
 Identical to rb_iv_set(), except it accepts the name as an ID instead of a C string. More...
 
VALUE rb_ivar_defined (VALUE obj, ID name)
 Queries if the instance variable is defined at the object. More...
 
void rb_ivar_foreach (VALUE obj, int(*func)(ID name, VALUE val, st_data_t arg), st_data_t arg)
 Iterates over an object's instance variables. More...
 
st_index_t rb_ivar_count (VALUE obj)
 Number of instance variables defined on an object. More...
 
VALUE rb_attr_get (VALUE obj, ID name)
 Identical to rb_ivar_get() More...
 
VALUE rb_obj_instance_variables (VALUE obj)
 Resembles Object#instance_variables. More...
 
VALUE rb_obj_remove_instance_variable (VALUE obj, VALUE name)
 Resembles Object#remove_instance_variable. More...
 
void * rb_mod_const_at (VALUE, void *)
 This API is mysterious. More...
 
void * rb_mod_const_of (VALUE, void *)
 This is a variant of rb_mod_const_at(). More...
 
VALUE rb_const_list (void *)
 This is another mysterious API that comes with no documents at all. More...
 
VALUE rb_mod_constants (int argc, const VALUE *argv, VALUE recv)
 Resembles Module#constants. More...
 
VALUE rb_mod_remove_const (VALUE space, VALUE name)
 Resembles Module#remove_const. More...
 
int rb_const_defined (VALUE space, ID name)
 Queries if the constant is defined at the namespace. More...
 
int rb_const_defined_at (VALUE space, ID name)
 Identical to rb_const_defined(), except it doesn't look for parent classes. More...
 
int rb_const_defined_from (VALUE space, ID name)
 Identical to rb_const_defined(), except it returns false for private constants. More...
 
VALUE rb_const_get (VALUE space, ID name)
 Identical to rb_const_defined(), except it returns the actual defined value. More...
 
VALUE rb_const_get_at (VALUE space, ID name)
 Identical to rb_const_defined_at(), except it returns the actual defined value. More...
 
VALUE rb_const_get_from (VALUE space, ID name)
 Identical to rb_const_defined_at(), except it returns the actual defined value. More...
 
void rb_const_set (VALUE space, ID name, VALUE val)
 Names a constant. More...
 
VALUE rb_const_remove (VALUE space, ID name)
 Identical to rb_mod_remove_const(), except it takes the name as ID instead of VALUE. More...
 
VALUE rb_cvar_defined (VALUE klass, ID name)
 Queries if the given class has the given class variable. More...
 
void rb_cvar_set (VALUE klass, ID name, VALUE val)
 Assigns a value to a class variable. More...
 
VALUE rb_cvar_get (VALUE klass, ID name)
 Obtains a value from a class variable. More...
 
VALUE rb_cvar_find (VALUE klass, ID name, VALUE *front)
 Identical to rb_cvar_get(), except it takes additional "front" pointer. More...
 
void rb_cv_set (VALUE klass, const char *name, VALUE val)
 Identical to rb_cvar_set(), except it accepts C's string instead of ID. More...
 
VALUE rb_cv_get (VALUE klass, const char *name)
 Identical to rb_cvar_get(), except it accepts C's string instead of ID. More...
 
void rb_define_class_variable (VALUE, const char *, VALUE)
 Just another name of rb_cv_set. More...
 
VALUE rb_mod_class_variables (int argc, const VALUE *argv, VALUE recv)
 Resembles Module#class_variables. More...
 
VALUE rb_mod_remove_cvar (VALUE mod, VALUE name)
 Resembles Module#remove_class_variable. More...
 

Detailed Description

Public APIs related to names inside of a Ruby program.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file variable.h.

Function Documentation

◆ rb_alias_variable()

void rb_alias_variable ( ID  dst,
ID  src 
)

Aliases a global variable.

Did you know that you can alias a global variable? It is like aliasing methods:

alias $dst $src

This C function does the same thing.

Parameters
[in]dstDestination name.
[in]srcSource name.
Postcondition
A global variable named dst is defined to be an alias of a global variable named src.

Definition at line 987 of file variable.c.

◆ rb_attr_get()

VALUE rb_attr_get ( VALUE  obj,
ID  name 
)

Identical to rb_ivar_get()

Parameters
[in]objTarget object.
[in]nameTarget instance variable to query.
Return values
RUBY_nilNo such instance variable.
otherwiseThe value assigned to the instance variable.

Definition at line 1358 of file variable.c.

◆ rb_autoload_load()

VALUE rb_autoload_load ( VALUE  space,
ID  name 
)

Kicks the autoload procedure as if it was "touched".

Parameters
[out]spaceNamespace where autoload is defined.
[in]nameName of the autoloaded constant.
Return values
RUBY_QfalseNo such autoload.
RUBY_QtrueAutoload successfully initiated.
Note
As an autoloaded library is expected to define space::name, it is a nature of this function to have process-global side effects.
Multiple threads can simultaneously call this API. It blocks then. That must not last indefinitely but can take longer than you expect.

Definition at line 2986 of file variable.c.

◆ rb_autoload_p()

VALUE rb_autoload_p ( VALUE  space,
ID  name 
)

Queries if an autoload is defined at a point.

Parameters
[in]spaceNamespace where autoload is defined.
[in]nameName of the autoloaded constant.
Return values
RUBY_QnilNo such autoload.
otherwiseThe feature (path) registered at space::name.

Definition at line 3024 of file variable.c.

◆ rb_class_name()

VALUE rb_class_name ( VALUE  obj)

Queries the name of the given object's class.

Parameters
[in]objArbitrary object.
Returns
An instance of rb_cString representing obj's class' path.

Definition at line 412 of file variable.c.

Referenced by rb_any_to_s().

◆ rb_class_path()

VALUE rb_class_path ( VALUE  mod)

Identical to rb_mod_name(), except it returns #<Class: ...> style inspection for anonymous modules.

Parameters
[in]modAn instance of rb_cModule.
Returns
An instance of rb_cString representing mod's path.

Definition at line 293 of file variable.c.

Referenced by rb_class_name(), and rb_profile_frame_classpath().

◆ rb_class_path_cached()

VALUE rb_class_path_cached ( VALUE  mod)

Just another name of rb_mod_name.

Definition at line 302 of file variable.c.

◆ rb_const_defined()

int rb_const_defined ( VALUE  space,
ID  name 
)

Queries if the constant is defined at the namespace.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Return values
RUBY_QtrueThere is a constant.
RUBY_QfalseNo such constant.

Definition at line 3472 of file variable.c.

Referenced by rb_define_class(), and rb_define_module().

◆ rb_const_defined_at()

int rb_const_defined_at ( VALUE  space,
ID  name 
)

Identical to rb_const_defined(), except it doesn't look for parent classes.

For instance Array is a toplevel constant, which is visible from everywhere. But this function does not take such things into account. It concerns only what is directly defined inside of the given namespace.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Return values
RUBY_QtrueThere is a constant.
RUBY_QfalseNo such constant.

Definition at line 3478 of file variable.c.

Referenced by rb_define_module_id_under().

◆ rb_const_defined_from()

int rb_const_defined_from ( VALUE  space,
ID  name 
)

Identical to rb_const_defined(), except it returns false for private constants.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Return values
RUBY_QtrueThere is a constant.
RUBY_QfalseNo such constant.

Definition at line 3466 of file variable.c.

◆ rb_const_get()

VALUE rb_const_get ( VALUE  space,
ID  name 
)

Identical to rb_const_defined(), except it returns the actual defined value.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Exceptions
rb_eNameErrorNo such constant.
Returns
The defined constant.

Definition at line 3151 of file variable.c.

◆ rb_const_get_at()

VALUE rb_const_get_at ( VALUE  space,
ID  name 
)

Identical to rb_const_defined_at(), except it returns the actual defined value.

It can also be seen as a routine identical to rb_const_get(), except it doesn't look for parent classes.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Exceptions
rb_eNameErrorNo such constant.
Returns
The defined constant.

Definition at line 3157 of file variable.c.

Referenced by rb_define_module_id_under().

◆ rb_const_get_from()

VALUE rb_const_get_from ( VALUE  space,
ID  name 
)

Identical to rb_const_defined_at(), except it returns the actual defined value.

It can also be seen as a routine identical to rb_const_get(), except it doesn't return a private constant.

Parameters
[in]spaceTarget namespace.
[in]nameTarget name to query.
Exceptions
rb_eNameErrorNo such constant.
Returns
The defined constant.

Definition at line 3145 of file variable.c.

◆ rb_const_list()

VALUE rb_const_list ( void *  data)

This is another mysterious API that comes with no documents at all.

It seems it expects some specific data structure for the passed pointer. But the details has never been made explicit. It seems nobody should use this API.

Definition at line 3384 of file variable.c.

Referenced by rb_mod_constants().

◆ rb_const_remove()

VALUE rb_const_remove ( VALUE  space,
ID  name 
)

Identical to rb_mod_remove_const(), except it takes the name as ID instead of VALUE.

Parameters
[out]spaceTarget namespace.
[in]nameVariable name to remove, either in Symbol or String.
Returns
What was removed.
Precondition
Constant named space::name is deleted.
Note
In case what was removed was in fact a module or a class, this operation does not affect its name. Which means when people for instance look at it using p etc., it still introduces itself using the deleted name. Can confuse people.

Definition at line 3267 of file variable.c.

◆ rb_const_set()

void rb_const_set ( VALUE  space,
ID  name,
VALUE  val 
)

Names a constant.

Parameters
[out]spaceTarget namespace.
[in]nameTarget name to query.
[in]valValue to define.
Exceptions
rb_eTypeErrorspace is not a module.
Postcondition
name is a constant under space, whose value is val.
Note
You can reassign.

Definition at line 3619 of file variable.c.

Referenced by rb_define_const(), rb_define_module_id_under(), and ruby_init_loadpath().

◆ rb_cv_get()

VALUE rb_cv_get ( VALUE  klass,
const char *  name 
)

Identical to rb_cvar_get(), except it accepts C's string instead of ID.

Parameters
[in]klassTarget class.
[in]nameVariable name.
Exceptions
rb_eNameErrorUninitialised class variable.
rb_eRuntimeError[Bug#14541] situation.
Returns
Class variable named name under klass.

Definition at line 4045 of file variable.c.

◆ rb_cv_set()

void rb_cv_set ( VALUE  klass,
const char *  name,
VALUE  val 
)

Identical to rb_cvar_set(), except it accepts C's string instead of ID.

Parameters
[out]klassTarget class.
[in]nameVariable name.
[in]valValue to be assigned.
Postcondition
klass has a class variable named name whose value is val.

Definition at line 4038 of file variable.c.

Referenced by rb_define_class_variable().

◆ rb_cvar_defined()

VALUE rb_cvar_defined ( VALUE  klass,
ID  name 
)

Queries if the given class has the given class variable.

Parameters
[in]klassTarget class.
[in]nameName to query.
Returns
RUBY_Qtrue Yes there is.
RUBY_Qfalse No there isn't.
Precondition
klass must be an instance of rb_cModule.

Definition at line 4019 of file variable.c.

◆ rb_cvar_find()

VALUE rb_cvar_find ( VALUE  klass,
ID  name,
VALUE front 
)

Identical to rb_cvar_get(), except it takes additional "front" pointer.

This extra parameter is a buffer, which will have the class where the queried class variable actually resides.

Parameters
[in]klassTarget class.
[in]nameVariable name.
[out]frontReturn buffer.
Exceptions
rb_eNameErrorUninitialised class variable.
rb_eRuntimeError[Bug#14541] situation.
Returns
Class variable named name under klass.
Postcondition
front has the class object, which is an ancestor of klass, where the queried class variable actually resides.

Definition at line 3997 of file variable.c.

Referenced by rb_cvar_get().

◆ rb_cvar_get()

VALUE rb_cvar_get ( VALUE  klass,
ID  name 
)

Obtains a value from a class variable.

Parameters
[in]klassTarget class.
[in]nameVariable name.
Exceptions
rb_eNameErrorUninitialised class variable.
rb_eRuntimeError[Bug#14541] situation.
Returns
Class variable named name under klass.

Definition at line 4012 of file variable.c.

Referenced by rb_cv_get().

◆ rb_cvar_set()

void rb_cvar_set ( VALUE  klass,
ID  name,
VALUE  val 
)

Assigns a value to a class variable.

Parameters
[out]klassTarget class.
[in]nameVariable name.
[in]valValue to be assigned.
Postcondition
klass has a class variable named name whose value is val.

Definition at line 3942 of file variable.c.

Referenced by rb_cv_set().

◆ rb_define_class_variable()

void rb_define_class_variable ( VALUE  klass,
const char *  name,
VALUE  val 
)

Just another name of rb_cv_set.

Definition at line 4052 of file variable.c.

◆ rb_f_global_variables()

VALUE rb_f_global_variables ( void  )

Queries the list of global variables.

Returns
The list of the name of the global variables.

Definition at line 955 of file variable.c.

◆ rb_f_trace_var()

VALUE rb_f_trace_var ( int  argc,
const VALUE argv 
)

Traces a global variable.

Parameters
[in]argcEither 1 or 2.
[in]argvVariable name, optionally a Proc.
Return values
RUBY_QnilNo previous tracers.
otherwisePrevious tracers.

Definition at line 755 of file variable.c.

◆ rb_f_untrace_var()

VALUE rb_f_untrace_var ( int  argc,
const VALUE argv 
)

Deletes the passed tracer from the passed global variable, or if omitted, deletes everything.

Parameters
[in]argcEither 1 or 2.
[in]argvVariable name, optionally a Proc.
Return values
RUBY_QnilNo previous tracers.
otherwiseDeleted tracers.

Definition at line 801 of file variable.c.

Referenced by rb_f_trace_var().

◆ rb_free_generic_ivar()

void rb_free_generic_ivar ( VALUE  obj)

Frees the list of instance variables.

3rd parties need not know, but there are several ways to store an object's instance variables, depending on its internal structure. This function makes sense when the passed objects is using so-called "generic" backend storage. People need not be aware of this working behind-the-scenes.

Parameters
[out]objThe object in question.

Definition at line 1155 of file variable.c.

◆ rb_ivar_count()

st_index_t rb_ivar_count ( VALUE  obj)

Number of instance variables defined on an object.

Parameters
[in]objTarget object.
Returns
Number of instance variables defined on obj.

Definition at line 2143 of file variable.c.

◆ rb_ivar_defined()

VALUE rb_ivar_defined ( VALUE  obj,
ID  name 
)

Queries if the instance variable is defined at the object.

This roughly resembles defined?(@name) in obj's context.

Parameters
[in]objTarget object.
[in]nameTarget instance variable to query.
Return values
RUBY_QtrueThere is an instance variable.
RUBY_QfalseNo such instance variable.

Definition at line 1876 of file variable.c.

◆ rb_ivar_foreach()

void rb_ivar_foreach ( VALUE  obj,
int(*)(ID name, VALUE val, st_data_t arg)  func,
st_data_t  arg 
)

Iterates over an object's instance variables.

Parameters
[in]objTarget object.
[in]funcCallback function.
[in]argPassed as-is to the last argument of func.

Referenced by rb_obj_instance_variables().

◆ rb_ivar_get()

VALUE rb_ivar_get ( VALUE  obj,
ID  name 
)

Identical to rb_iv_get(), except it accepts the name as an ID instead of a C string.

Parameters
[in]objTarget object.
[in]nameTarget instance variable to query.
Return values
RUBY_nilNo such instance variable.
otherwiseThe value assigned to the instance variable.

Definition at line 1350 of file variable.c.

Referenced by rb_iv_get().

◆ rb_ivar_set()

VALUE rb_ivar_set ( VALUE  obj,
ID  name,
VALUE  val 
)

Identical to rb_iv_set(), except it accepts the name as an ID instead of a C string.

Parameters
[out]objTarget object.
[in]nameTarget instance variable.
[in]valValue to assign.
Exceptions
rb_eFrozenErrorCan't modify obj.
rb_eArgErrorobj has too many instance variables.
Returns
Passed value.
Postcondition
An instance variable named name is defined if absent on obj, whose value is set to val.

Definition at line 1859 of file variable.c.

Referenced by rb_error_frozen_object(), rb_frozen_error_raise(), rb_iv_set(), rb_memory_view_register(), and ruby_init_loadpath().

◆ rb_mod_class_variables()

VALUE rb_mod_class_variables ( int  argc,
const VALUE argv,
VALUE  recv 
)

Resembles Module#class_variables.

List up the variables defined at the receiver. This includes the names of constants in any included modules, unless argv[0] is RUBY_Qfalse.

The implementation makes no guarantees about the order in which the constants are yielded.

Parameters
[in]argcEither 0 or 1.
[in]argvPointer to RUBY_Qfalse, if argc == 1.
[in]recvTarget class.
Returns
An array of symbols, which are class variable names under recv.

Definition at line 4142 of file variable.c.

◆ rb_mod_const_at()

void* rb_mod_const_at ( VALUE  mod,
void *  data 
)

This API is mysterious.

It has been there since the initial revision. No single bits of documents has ever been written. The function name doesn't describe anything. What should be passed to the argument, or what should be the return value, are not obvious. Yet it has evolved over time. The source code is written in counter-intuitive way (as of 3.0).

Simply put, don't try to understand this API.

Definition at line 3345 of file variable.c.

Referenced by rb_mod_const_of().

◆ rb_mod_const_of()

void* rb_mod_const_of ( VALUE  mod,
void *  data 
)

This is a variant of rb_mod_const_at().

As a result, it is also mysterious. It seems it iterates over the ancestry tree of the module. But what that means is beyond a human brain.

Definition at line 3362 of file variable.c.

Referenced by rb_mod_constants().

◆ rb_mod_constants()

VALUE rb_mod_constants ( int  argc,
const VALUE argv,
VALUE  recv 
)

Resembles Module#constants.

List up the constants defined at the receiver. This includes the names of constants in any included modules, unless argv[0] is RUBY_Qfalse.

The implementation makes no guarantees about the order in which the constants are yielded.

Parameters
[in]argcEither 0 or 1.
[in]argvPointer to RUBY_Qfalse, if argc == 1.
[in]recvTarget namespace.
Returns
An array of symbols, which are constant names under recv.

Definition at line 3416 of file variable.c.

◆ rb_mod_name()

VALUE rb_mod_name ( VALUE  mod)

Queries the name of a module.

Parameters
[in]modAn instance of rb_cModule.
Return values
RUBY_Qnilmod is anonymous.
otherwisemod is onymous.

Definition at line 130 of file variable.c.

Referenced by rb_class_path_cached().

◆ rb_mod_remove_const()

VALUE rb_mod_remove_const ( VALUE  space,
VALUE  name 
)

Resembles Module#remove_const.

Parameters
[out]spaceTarget namespace.
[in]nameVariable name to remove, either in Symbol or String.
Returns
What was removed.
Precondition
Constant named space::name is deleted.
Note
In case what was removed was in fact a module or a class, this operation does not affect its name. Which means when people for instance look at it using p etc., it still introduces itself using the deleted name. Can confuse people.

Definition at line 3256 of file variable.c.

◆ rb_mod_remove_cvar()

VALUE rb_mod_remove_cvar ( VALUE  mod,
VALUE  name 
)

Resembles Module#remove_class_variable.

Parameters
[out]modTarget class.
[in]nameVariable name to remove, either in Symbol or String.
Returns
What was removed.
Precondition
Instance variable named name is deleted from obj.

Definition at line 4177 of file variable.c.

◆ rb_obj_instance_variables()

VALUE rb_obj_instance_variables ( VALUE  obj)

Resembles Object#instance_variables.

Parameters
[in]objTarget object to query.
Returns
An array of instance variable names for the receiver.
Note
Simply defining an accessor does not create the corresponding instance variable.

Definition at line 2195 of file variable.c.

◆ rb_obj_remove_instance_variable()

VALUE rb_obj_remove_instance_variable ( VALUE  obj,
VALUE  name 
)

Resembles Object#remove_instance_variable.

Parameters
[out]objTarget object.
[in]nameVariable name to remove, either in Symbol or String.
Returns
What was removed.
Precondition
Instance variable named name is deleted from obj.

Definition at line 2249 of file variable.c.

◆ rb_path2class()

VALUE rb_path2class ( const char *  path)

Resolves a Q::W::E::R-style path string to the actual class it points.

Parameters
[in]pathPath to query.
Exceptions
rb_eArgErrorNo such constant.
rb_eTypeErrorThe path resolved to a non-module.
Returns
Resolved class.

Definition at line 406 of file variable.c.

◆ rb_path_to_class()

VALUE rb_path_to_class ( VALUE  path)

Identical to rb_path2class(), except it accepts the path as Ruby's string instead of C's.

Parameters
[in]pathPath to query.
Exceptions
rb_eArgErrorNo such constant.
rb_eTypeErrorThe path resolved to a non-module.
Returns
Resolved class.

Definition at line 361 of file variable.c.

Referenced by rb_path2class().

◆ rb_set_class_path()

void rb_set_class_path ( VALUE  klass,
VALUE  space,
const char *  name 
)

Names a class.

Parameters
[out]klassTarget module to name.
[out]spaceNamespace that klass shall reside.
[in]nameName of klass.
Postcondition
klass has space::klass name.

Definition at line 353 of file variable.c.

◆ rb_set_class_path_string()

void rb_set_class_path_string ( VALUE  klass,
VALUE  space,
VALUE  name 
)

Identical to rb_set_class_path(), except it accepts the name as Ruby's string instead of C's.

Parameters
[out]klassTarget module to name.
[out]spaceNamespace that klass shall reside.
[in]nameName of klass.
Postcondition
klass has space::klass name.

Definition at line 336 of file variable.c.

Referenced by rb_define_module_id_under(), and rb_set_class_path().