method
remove_class_variable
v2_1_10 -
Show latest stable
- Class:
Module
remove_class_variable(p1)public
Removes the definition of the sym, returning that constant’s value.
class Dummy @@var = 99 puts @@var remove_class_variable(:@@var) p(defined? @@var) end
produces:
99 nil
VALUE
rb_mod_remove_cvar(VALUE mod, VALUE name)
{
const ID id = rb_check_id(&name);
st_data_t val, n = id;
if (!id) {
if (rb_is_class_name(name)) {
rb_name_error_str(name, "class variable %"PRIsVALUE" not defined for %"PRIsVALUE"",
name, rb_class_name(mod));
}
else {
rb_name_error_str(name, "wrong class variable name %"PRIsVALUE"", QUOTE(name));
}
}
if (!rb_is_class_id(id)) {
rb_name_error(id, "wrong class variable name %"PRIsVALUE"", QUOTE_ID(id));
}
rb_check_frozen(mod);
if (RCLASS_IV_TBL(mod) && st_delete(RCLASS_IV_TBL(mod), &n, &val)) {
return (VALUE)val;
}
if (rb_cvar_defined(mod, id)) {
rb_name_error(id, "cannot remove %"PRIsVALUE" for %"PRIsVALUE"",
QUOTE_ID(id), rb_class_name(mod));
}
rb_name_error(id, "class variable %"PRIsVALUE" not defined for %"PRIsVALUE"",
QUOTE_ID(id), rb_class_name(mod));
UNREACHABLE;
} Related methods
- Instance methods
- <
- <=
- <=>
- ==
- ===
- >
- >=
- ancestors
- autoload
- autoload?
- class_eval
- class_exec
- class_variable_defined?
- class_variable_get
- class_variable_set
- class_variables
- const_defined?
- const_get
- const_missing
- const_set
- constants
- freeze
- include
- include?
- included_modules
- infect_an_assertion
- infect_with_assertions
- initialize_copy
- inspect
- instance_method
- instance_methods
- method_defined?
- module_eval
- module_exec
- name
- prepend
- private_class_method
- private_constant
- private_instance_methods
- private_method_defined?
- protected_instance_methods
- protected_method_defined?
- psych_yaml_as
- public_class_method
- public_constant
- public_instance_method
- public_instance_methods
- public_method_defined?
- rake_extension
- remove_class_variable
- singleton_class?
- to_s
- yaml_as
- Class methods
- constants
- nesting
- new
- Private methods
-
alias_method -
append_features -
attr -
attr_accessor -
attr_reader -
attr_writer -
define_method -
extend_object -
extended -
included -
method_added -
method_removed -
method_undefined -
module_function -
prepend_features -
prepended -
private -
protected -
public -
refine -
remove_const -
remove_method -
undef_method -
using