Ruby
1.9.3p448(2013-06-27revision41675)
|
Data Structures | |
struct | clone_method_data |
Macros | |
#define | METACLASS_OF(k) RBASIC(k)->klass |
#define | META_CLASS_OF_CLASS_CLASS_P(k) (METACLASS_OF(k) == (k)) |
whether k is a meta^(n)-class of Class class | |
#define | ENSURE_EIGENCLASS(klass) (rb_ivar_get(METACLASS_OF(klass), id_attached) == (klass) ? METACLASS_OF(klass) : make_metaclass(klass)) |
ensures klass belongs to its own eigenclass. | |
#define | VISI(x) ((x)&NOEX_MASK) |
#define | VISI_CHECK(x, f) (VISI(x) == (f)) |
#define | SPECIAL_SINGLETON(x, c) |
Variables | |
st_table * | rb_class_tbl |
static ID | id_attached |
#define ENSURE_EIGENCLASS | ( | klass | ) | (rb_ivar_get(METACLASS_OF(klass), id_attached) == (klass) ? METACLASS_OF(klass) : make_metaclass(klass)) |
ensures klass belongs to its own eigenclass.
Definition at line 295 of file class.c.
Referenced by make_metaclass(), and rb_singleton_class().
#define META_CLASS_OF_CLASS_CLASS_P | ( | k | ) | (METACLASS_OF(k) == (k)) |
whether k is a meta^(n)-class of Class class
1 | if k is a meta^(n)-class of Class class (n >= 0) |
0 | otherwise |
Definition at line 285 of file class.c.
Referenced by make_metaclass().
#define METACLASS_OF | ( | k | ) | RBASIC(k)->klass |
Definition at line 278 of file class.c.
Referenced by make_metaclass(), and make_singleton_class().
#define SPECIAL_SINGLETON | ( | x, | |
c | |||
) |
Definition at line 1240 of file class.c.
Referenced by singleton_class_of().
#define VISI | ( | x | ) | ((x)&NOEX_MASK) |
Definition at line 808 of file class.c.
Referenced by method_entry_i().
Definition at line 357 of file class.c.
References rb_class_boot(), rb_class_tbl, rb_cObject, rb_const_set(), rb_intern, rb_name_class(), and st_add_direct.
Referenced by Init_class_hierarchy().
Allocates a struct RClass for a new class.
flags | initial value for basic.flags of the returned class. |
klass | the class of the returned class. |
klass
must refer Class
class or an ancestor of Class. initialize
'd.Definition at line 50 of file class.c.
References ALLOC, NEWOBJ, OBJSETUP, RCLASS_CONST_TBL, RCLASS_IV_INDEX_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, and RCLASS_SUPER.
Referenced by include_class_new(), rb_class_boot(), rb_module_new(), and rb_singleton_class_clone().
Definition at line 163 of file class.c.
References FL_SINGLETON, FL_TEST, rb_cBasicObject, rb_eTypeError, rb_raise(), and RCLASS_SUPER.
Referenced by rb_mod_init_copy().
|
static |
Definition at line 880 of file class.c.
References BUILTIN_TYPE, FL_SINGLETON, FL_TEST, func, list, method_entry_i(), mod, rb_ary_new(), rb_scan_args(), RCLASS_M_TBL, RCLASS_SUPER, recur, RTEST, st_foreach, st_free_table, st_init_numtable, T_ICLASS, and TRUE.
Referenced by rb_class_instance_methods(), rb_class_private_instance_methods(), rb_class_protected_instance_methods(), rb_class_public_instance_methods(), rb_obj_methods(), rb_obj_private_methods(), rb_obj_protected_methods(), and rb_obj_public_methods().
|
static |
Definition at line 148 of file class.c.
References ALLOC, ST_CONTINUE, and st_insert.
Referenced by clone_const_i().
Definition at line 157 of file class.c.
References clone_const().
Referenced by rb_mod_init_copy(), and rb_singleton_class_clone().
|
static |
Definition at line 131 of file class.c.
References rb_method_definition_struct::body, rb_method_entry_struct::def, rb_method_entry_struct::flag, GetISeqPtr, rb_method_definition_struct::iseq, clone_method_data::klass, rb_add_method(), RB_GC_GUARD, rb_iseq_clone(), rb_method_entry_set(), rb_iseq_struct::self, ST_CONTINUE, rb_method_definition_struct::type, and VM_METHOD_TYPE_ISEQ.
Referenced by rb_mod_init_copy(), and rb_singleton_class_clone().
Definition at line 632 of file class.c.
References BUILTIN_TYPE, class_alloc(), clone_method_data::klass, OBJ_INFECT, rb_cClass, RBASIC, RCLASS_CONST_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, st_init_numtable, T_ICLASS, and TYPE.
Referenced by rb_include_module().
void Init_class_hierarchy | ( | void | ) |
Definition at line 370 of file class.c.
References boot_defclass(), id_attached, rb_cBasicObject, rb_cClass, rb_cModule, rb_cObject, rb_const_set(), rb_intern, and RBASIC.
Referenced by Init_Object().
void Init_Object | ( | void | ) |
Initializes the world of objects and classes.
At first, the function bootstraps the class hierarchy. It initializes the most fundamental classes and their metaclasses.
BasicObject
Object
Module
Class
After the bootstrap step, the class hierarchy becomes as the following diagram.Then, the function defines classes, modules and methods as usual.
Definition at line 2642 of file object.c.
References CLASS_OF, conv_method_names, false_and(), false_or(), false_to_s(), false_xor(), i, conv_method_tbl::id, id_eq, id_eql, id_init_clone, id_init_copy, id_init_dup, id_inspect, id_match, Init_class_hierarchy(), conv_method_tbl::method, nil_inspect(), nil_to_a(), nil_to_f(), nil_to_i(), nil_to_s(), Qfalse, Qnil, Qtrue, rb_any_to_s(), rb_cBasicObject, rb_cClass, rb_cData, rb_cFalseClass, rb_class_allocate_instance(), rb_class_inherited_p(), rb_class_initialize(), rb_class_instance_methods(), rb_class_new_instance(), rb_class_private_instance_methods(), rb_class_protected_instance_methods(), rb_class_public_instance_methods(), rb_class_s_alloc(), rb_class_superclass(), rb_cModule, rb_cNilClass, rb_cObject, rb_cTrueClass, rb_define_alloc_func(), rb_define_class(), rb_define_global_const(), rb_define_global_function(), rb_define_method(), rb_define_module(), rb_define_private_method(), rb_equal(), rb_f_array(), rb_f_float(), rb_f_integer(), rb_f_sprintf(), rb_f_string(), rb_false(), rb_include_module(), rb_intern, rb_mKernel, rb_mod_ancestors(), rb_mod_attr(), rb_mod_attr_accessor(), rb_mod_attr_reader(), rb_mod_attr_writer(), rb_mod_class_variables(), rb_mod_cmp(), rb_mod_const_defined(), rb_mod_const_get(), rb_mod_const_missing(), rb_mod_const_set(), rb_mod_constants(), rb_mod_cvar_defined(), rb_mod_cvar_get(), rb_mod_cvar_set(), rb_mod_eqq(), rb_mod_freeze(), rb_mod_ge(), rb_mod_gt(), rb_mod_include_p(), rb_mod_included_modules(), rb_mod_init_copy(), rb_mod_initialize(), rb_mod_lt(), rb_mod_name(), rb_mod_private_constant(), rb_mod_public_constant(), rb_mod_remove_const(), rb_mod_remove_cvar(), rb_mod_to_s(), rb_module_s_alloc(), rb_obj_alloc(), rb_obj_class(), rb_obj_clone(), rb_obj_cmp(), rb_obj_dummy(), rb_obj_dup(), rb_obj_equal(), rb_obj_freeze(), rb_obj_frozen_p(), rb_obj_hash(), rb_obj_init_copy(), rb_obj_init_dup_clone(), rb_obj_inspect(), rb_obj_instance_variables(), rb_obj_is_instance_of(), rb_obj_is_kind_of(), rb_obj_ivar_defined(), rb_obj_ivar_get(), rb_obj_ivar_set(), rb_obj_match(), rb_obj_methods(), rb_obj_not(), rb_obj_not_equal(), rb_obj_not_match(), rb_obj_private_methods(), rb_obj_protected_methods(), rb_obj_public_methods(), rb_obj_remove_instance_variable(), rb_obj_singleton_class(), rb_obj_singleton_methods(), rb_obj_taint(), rb_obj_tainted(), rb_obj_tap(), rb_obj_trust(), rb_obj_untaint(), rb_obj_untrust(), rb_obj_untrusted(), rb_true(), rb_undef_alloc_func(), rb_undef_method(), true_and(), true_or(), true_to_s(), and true_xor().
Definition at line 833 of file class.c.
References ins_methods_push().
Referenced by rb_class_instance_methods(), rb_obj_methods(), and rb_obj_singleton_methods().
Definition at line 845 of file class.c.
References ins_methods_push(), and NOEX_PRIVATE.
Referenced by rb_class_private_instance_methods(), and rb_obj_private_methods().
Definition at line 839 of file class.c.
References ins_methods_push(), and NOEX_PROTECTED.
Referenced by rb_class_protected_instance_methods(), and rb_obj_protected_methods().
Definition at line 851 of file class.c.
References ins_methods_push(), and NOEX_PUBLIC.
Referenced by rb_class_public_instance_methods(), and rb_obj_public_methods().
Definition at line 812 of file class.c.
References ID2SYM, NOEX_PRIVATE, NOEX_PROTECTED, NOEX_PUBLIC, rb_ary_push(), and ST_CONTINUE.
Referenced by ins_methods_i(), ins_methods_priv_i(), ins_methods_prot_i(), and ins_methods_pub_i().
Creates a metaclass of klass.
klass | a class |
Definition at line 309 of file class.c.
References ENSURE_EIGENCLASS, FL_SET, FL_SINGLETON, META_CLASS_OF_CLASS_CLASS_P, METACLASS_OF, OBJ_INFECT, Qundef, rb_cClass, rb_class_boot(), rb_singleton_class_attached(), RB_TYPE_P, RCLASS_SUPER, and T_ICLASS.
Referenced by rb_make_metaclass().
Creates a singleton class for obj.
Definition at line 342 of file class.c.
References FL_SET, FL_SINGLETON, clone_method_data::klass, METACLASS_OF, rb_class_boot(), rb_class_real(), rb_singleton_class_attached(), and RBASIC.
Referenced by rb_make_metaclass().
Definition at line 857 of file class.c.
References rb_method_entry_struct::flag, ID_ALLOCATOR, list, st_add_direct, ST_CONTINUE, st_lookup, type, UNDEFINED_METHOD_ENTRY_P, and VISI.
Referenced by class_instance_method_list(), and rb_obj_singleton_methods().
void rb_check_inheritable | ( | VALUE | super | ) |
Ensures a class can be derived from super.
super | a reference to an object. |
TypeError | if super is not a Class or super is a singleton class. |
Definition at line 94 of file class.c.
References FL_SINGLETON, rb_cClass, rb_eTypeError, rb_obj_classname(), rb_raise(), RBASIC, T_CLASS, and TYPE.
Referenced by rb_class_initialize(), and rb_class_new().
A utility function that wraps class_alloc.
allocates a class and initializes safely.
super | a class from which the new class derives. |
Definition at line 75 of file class.c.
References class_alloc(), OBJ_INFECT, rb_cClass, RCLASS_M_TBL, RCLASS_SUPER, st_init_numtable, and T_CLASS.
Referenced by boot_defclass(), make_metaclass(), make_singleton_class(), rb_class_new(), and rb_class_s_alloc().
Calls Class::inherited.
super | A class which will be called #inherited. NULL means Object class. |
klass | A Class object which derived from super |
Class::inherited's
returns Class
object. Definition at line 442 of file class.c.
References CONST_ID, rb_cObject, and rb_funcall().
Referenced by make_struct(), rb_class_initialize(), rb_define_class(), rb_define_class_id_under(), and rb_struct_define_without_accessor().
Definition at line 937 of file class.c.
References class_instance_method_list(), and ins_methods_i().
Referenced by Init_Object().
Creates a new class.
super | a class from which the new class derives. |
TypeError | super is not inheritable. |
TypeError | super is the Class class. |
Definition at line 116 of file class.c.
References Check_Type, rb_check_inheritable(), rb_class_boot(), and T_CLASS.
Referenced by Init_IO(), Init_VM(), make_struct(), rb_define_class_id(), and rb_struct_define_without_accessor().
Definition at line 975 of file class.c.
References class_instance_method_list(), and ins_methods_priv_i().
Referenced by Init_Object().
Definition at line 952 of file class.c.
References class_instance_method_list(), and ins_methods_prot_i().
Referenced by Init_Object().
Definition at line 990 of file class.c.
References class_instance_method_list(), and ins_methods_pub_i().
Referenced by Init_Object().
Defines a top-level class.
name | name of the class |
super | a class from which the new class will derive. NULL means Object class. |
TypeError | if the constant name name is already taken but the constant is not a Class . |
NameError | if the class is already defined but the class can not be reopened because its superclass is not super. |
Definition at line 468 of file class.c.
References id, clone_method_data::klass, rb_class_inherited(), rb_class_real(), rb_cObject, rb_const_defined(), rb_const_get(), rb_const_set(), rb_define_class_id(), rb_eTypeError, rb_intern, rb_name_class(), rb_raise(), rb_warn(), RCLASS_SUPER, st_add_direct, T_CLASS, and TYPE.
Referenced by Init_Array(), Init_bigdecimal(), Init_Bignum(), Init_Binding(), Init_Complex(), Init_Cont(), Init_date_core(), Init_dbm(), Init_Dir(), Init_Encoding(), Init_Enumerator(), Init_Exception(), Init_File(), Init_gdbm(), Init_Hash(), Init_iconv(), Init_IO(), Init_Numeric(), Init_Object(), Init_pathname(), Init_Proc(), Init_Random(), Init_Rational(), Init_Regexp(), Init_sdbm(), Init_socket(), Init_String(), Init_stringio(), Init_strscan(), Init_Struct(), Init_tcltklib(), Init_Thread(), Init_Time(), Init_tkutil(), Init_VM(), Init_win32ole(), rb_struct_define_without_accessor(), rsock_init_addrinfo(), rsock_init_basicsocket(), rsock_init_ipsocket(), rsock_init_socket_init(), rsock_init_sockssocket(), rsock_init_tcpserver(), rsock_init_tcpsocket(), rsock_init_udpsocket(), rsock_init_unixserver(), rsock_init_unixsocket(), and ruby_Init_Continuation_body().
Defines a new class.
id | ignored |
super | A class from which the new class will derive. NULL means Object class. |
TypeError | if super is not a Class object. |
Definition at line 421 of file class.c.
References clone_method_data::klass, rb_class_new(), rb_cObject, rb_make_metaclass(), and RBASIC.
Referenced by rb_define_class(), and rb_define_class_id_under().
Defines a class under the namespace of outer.
outer | a class which contains the new class. |
id | name of the new class |
super | a class from which the new class will derive. NULL means Object class. |
TypeError | if the constant name name is already taken but the constant is not a Class . |
NameError | if the class is already defined but the class can not be reopened because its superclass is not super. |
Definition at line 537 of file class.c.
References clone_method_data::klass, rb_class2name(), rb_class_inherited(), rb_class_real(), rb_const_defined_at(), rb_const_get_at(), rb_const_set(), rb_define_class_id(), rb_eTypeError, rb_gc_register_mark_object(), rb_id2name(), rb_id2str(), rb_name_error(), rb_raise(), rb_set_class_path_string(), rb_warn(), RCLASS_SUPER, T_CLASS, and TYPE.
Referenced by make_struct(), and rb_define_class_under().
Defines a class under the namespace of outer.
outer | a class which contains the new class. |
name | name of the new class |
super | a class from which the new class will derive. NULL means Object class. |
TypeError | if the constant name name is already taken but the constant is not a Class . |
NameError | if the class is already defined but the class can not be reopened because its superclass is not super. |
Definition at line 514 of file class.c.
References rb_define_class_id_under(), and rb_intern.
Referenced by exp1(), Init_cparse(), Init_curses(), Init_digest(), Init_dl(), Init_dlcfunc(), Init_dlhandle(), Init_dlptr(), Init_Enumerator(), Init_Exception(), Init_fiddle_closure(), Init_fiddle_function(), Init_File(), Init_generator(), Init_iconv(), Init_ISeq(), Init_md5(), Init_numhash(), Init_openssl(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_dh(), Init_ossl_digest(), Init_ossl_dsa(), Init_ossl_hmac(), Init_ossl_ns_spki(), Init_ossl_pkcs12(), Init_ossl_pkcs5(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509name(), Init_ossl_x509req(), Init_ossl_x509revoked(), Init_ossl_x509store(), Init_parser(), Init_process(), Init_psych_emitter(), Init_psych_parser(), Init_psych_to_ruby(), Init_psych_yaml_tree(), Init_pty(), Init_rmd160(), Init_sha1(), Init_string(), Init_strscan(), Init_syck(), Init_tkutil(), Init_transcode(), Init_VM(), Init_zlib(), rsock_init_ancdata(), rsock_init_sockopt(), and set_syserr().
Definition at line 586 of file class.c.
References id, rb_cObject, rb_const_defined(), rb_const_get(), rb_const_set(), rb_define_module_id(), rb_eTypeError, rb_intern, rb_obj_classname(), rb_raise(), st_add_direct, T_MODULE, and TYPE.
Referenced by exp1(), Init_bigdecimal(), Init_bug(), Init_Comparable(), Init_coverage(), Init_cparse(), Init_curses(), Init_digest(), Init_dl(), Init_dln(), Init_Enumerable(), Init_etc(), Init_Exception(), Init_fcntl(), Init_fd_setsize(), Init_fiddle(), Init_fiddle_closure(), Init_File(), Init_GC(), Init_generator(), Init_marshal(), Init_nkf(), Init_numhash(), Init_Object(), Init_openssl(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_dh(), Init_ossl_digest(), Init_ossl_dsa(), Init_ossl_hmac(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509cert(), Init_parser(), Init_process(), Init_psych(), Init_psych_emitter(), Init_psych_parser(), Init_psych_to_ruby(), Init_psych_yaml_tree(), Init_pty(), Init_readline(), Init_signal(), Init_string(), Init_syslog(), Init_tcltklib(), Init_tkutil(), Init_zlib(), and process_options().
Definition at line 575 of file class.c.
References rb_module_new(), and rb_name_class().
Referenced by rb_define_module(), and rb_define_module_id_under().
Definition at line 612 of file class.c.
References rb_class2name(), rb_const_defined_at(), rb_const_get_at(), rb_const_set(), rb_define_module_id(), rb_eTypeError, rb_gc_register_mark_object(), rb_id2str(), rb_obj_classname(), rb_raise(), rb_set_class_path_string(), T_MODULE, and TYPE.
Referenced by rb_define_module_under().
Definition at line 606 of file class.c.
References rb_define_module_id_under(), and rb_intern.
Referenced by Init_curses(), Init_digest(), Init_dln(), Init_fd_setsize(), Init_File(), Init_GC(), Init_generator(), Init_iconv(), Init_IO(), Init_ossl_asn1(), Init_ossl_dh(), Init_ossl_dsa(), Init_ossl_ns_spki(), Init_ossl_pkcs5(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_rsa(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509(), Init_ossl_x509cert(), Init_parser(), Init_process(), Init_psych_to_ruby(), Init_psych_yaml_tree(), Init_stringio(), Init_syck(), Init_syslog(), Init_tcltklib(), Init_win32ole(), and InitVM_console().
Definition at line 662 of file class.c.
References BUILTIN_TYPE, Check_Type, FALSE, include_class_new(), clone_method_data::klass, OBJ_INFECT, OBJ_UNTRUSTED, p, rb_clear_cache(), rb_eArgError, rb_frozen_class_p(), rb_raise(), rb_secure(), RCLASS_M_TBL, RCLASS_SUPER, RMODULE_CONST_TBL, RMODULE_M_TBL, T_CLASS, T_ICLASS, T_MODULE, TRUE, and TYPE.
Referenced by Init_Array(), Init_date_core(), Init_dbm(), Init_digest(), Init_Dir(), Init_Enumerator(), Init_File(), Init_gdbm(), Init_Hash(), Init_iconv(), Init_IO(), Init_Numeric(), Init_Object(), Init_ossl_asn1(), Init_ossl_x509name(), Init_Range(), Init_sdbm(), Init_String(), Init_stringio(), Init_Struct(), Init_syck(), Init_syslog(), Init_Time(), Init_zlib(), rb_extend_object(), and rb_mod_append_features().
Definition at line 1352 of file iseq.c.
Referenced by clone_method(), and vm_define_method().
Creates a new singleton class for an object.
obj | An object. |
unused | ignored. |
Definition at line 399 of file class.c.
References BUILTIN_TYPE, make_metaclass(), make_singleton_class(), and T_CLASS.
Referenced by make_struct(), rb_class_initialize(), rb_define_class_id(), rb_struct_define_without_accessor(), and singleton_class_of().
Definition at line 791 of file class.c.
References BUILTIN_TYPE, FL_SINGLETON, FL_TEST, clone_method_data::klass, p, rb_ary_new(), rb_ary_push(), RBASIC, RCLASS_SUPER, and T_ICLASS.
Referenced by Init_Object().
Definition at line 761 of file class.c.
References BUILTIN_TYPE, Check_Type, p, Qfalse, Qtrue, RBASIC, RCLASS_SUPER, T_ICLASS, and T_MODULE.
Referenced by Init_Object().
Definition at line 728 of file class.c.
References BUILTIN_TYPE, clone_method_data::klass, p, rb_ary_new(), rb_ary_push(), RBASIC, RCLASS_SUPER, and T_ICLASS.
Referenced by Init_Object().
Definition at line 178 of file class.c.
References class_init_copy_check(), CLASS_OF, clone_const_i(), clone_method(), CONST_ID, FL_SINGLETON, FL_TEST, id, clone_method_data::klass, rb_free_const_table(), rb_free_m_table(), rb_obj_init_copy(), rb_singleton_class_attached(), rb_singleton_class_clone(), RB_TYPE_P, RBASIC, RCLASS_CONST_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, st_copy, st_delete, st_foreach, st_free_table, st_init_numtable, T_CLASS, and clone_method_data::tbl.
Referenced by Init_Object().
VALUE rb_module_new | ( | void | ) |
Definition at line 565 of file class.c.
References class_alloc(), rb_cModule, RCLASS_M_TBL, st_init_numtable, and T_MODULE.
Referenced by rb_define_module_id(), rb_eval_string_wrap(), rb_load_internal(), and rb_module_s_alloc().
Definition at line 1015 of file class.c.
References args, class_instance_method_list(), CLASS_OF, ins_methods_i(), Qtrue, rb_obj_singleton_methods(), rb_scan_args(), recur, and RTEST.
Referenced by Init_Object().
Definition at line 1061 of file class.c.
References class_instance_method_list(), CLASS_OF, and ins_methods_priv_i().
Referenced by Init_Object().
Definition at line 1046 of file class.c.
References class_instance_method_list(), CLASS_OF, and ins_methods_prot_i().
Referenced by Init_Object().
Definition at line 1076 of file class.c.
References class_instance_method_list(), CLASS_OF, and ins_methods_pub_i().
Referenced by Init_Object().
Definition at line 1115 of file class.c.
References CLASS_OF, FL_SINGLETON, FL_TEST, ins_methods_i(), clone_method_data::klass, list, method_entry_i(), Qtrue, rb_ary_new(), rb_scan_args(), RCLASS_M_TBL, RCLASS_SUPER, recur, RTEST, st_foreach, st_free_table, st_init_numtable, T_ICLASS, and TYPE.
Referenced by Init_Object(), and rb_obj_methods().
Returns the singleton class of obj.
Creates it if necessary.
obj | an arbitrary object. |
TypeError | if obj is a Fixnum or a Symbol. |
Definition at line 1315 of file class.c.
References ENSURE_EIGENCLASS, clone_method_data::klass, singleton_class_of(), T_CLASS, and TYPE.
Referenced by Init_date_core(), Init_nkf(), Init_process(), Init_VM(), num_sadded(), rb_define_alloc_func(), rb_extend_object(), rb_mod_modfunc(), rb_obj_define_method(), rb_obj_instance_eval(), rb_obj_instance_exec(), rb_obj_singleton_class(), rb_undef_alloc_func(), and vm_define_method().
Attach a object to a singleton class.
Definition at line 266 of file class.c.
References FL_SINGLETON, FL_TEST, id_attached, RCLASS_IV_TBL, st_init_numtable, and st_insert.
Referenced by make_metaclass(), make_singleton_class(), rb_mod_init_copy(), and rb_singleton_class_clone().
Definition at line 224 of file class.c.
References BUILTIN_TYPE, class_alloc(), clone_const_i(), clone_method(), FL_MARK, FL_SET, FL_SINGLETON, FL_TEST, clone_method_data::klass, rb_singleton_class_attached(), rb_singleton_class_clone(), RBASIC, RCLASS_CONST_TBL, RCLASS_IV_TBL, RCLASS_M_TBL, RCLASS_SUPER, st_copy, st_foreach, st_init_numtable, T_CLASS, and clone_method_data::tbl.
Referenced by rb_mod_init_copy(), rb_obj_clone(), and rb_singleton_class_clone().
Returns the singleton class of obj. Creates it if necessary.
Definition at line 1257 of file class.c.
References FIXNUM_P, FL_SINGLETON, FL_TAINT, FL_TEST, FL_UNSET, FL_UNTRUSTED, id_attached, clone_method_data::klass, OBJ_FREEZE, OBJ_FROZEN, OBJ_TAINT, OBJ_TAINTED, OBJ_UNTRUST, OBJ_UNTRUSTED, Qfalse, Qnil, Qtrue, rb_bug(), rb_cFalseClass, rb_cNilClass, rb_cTrueClass, rb_eTypeError, rb_ivar_get(), rb_make_metaclass(), rb_raise(), rb_special_const_p(), RBASIC, SPECIAL_SINGLETON, and SYMBOL_P.
Referenced by rb_define_singleton_method(), and rb_singleton_class().
|
static |
Definition at line 35 of file class.c.
Referenced by Init_class_hierarchy(), rb_singleton_class_attached(), and singleton_class_of().
st_table* rb_class_tbl |
Definition at line 23 of file variable.c.
Referenced by boot_defclass().