APIdock / Ruby
/
Browse About
method

class_variables

v1_9_3_392 - Show latest stable - Class: Module
class_variables()
public

Returns an array of the names of class variables in mod.

class One
  @@var1 = 1
end
class Two < One
  @@var2 = 2
end
One.class_variables   #=> [:@@var1]
Two.class_variables   #=> [:@@var2]
VALUE
rb_mod_class_variables(VALUE obj)
{
    VALUE ary = rb_ary_new();

    if (RCLASS_IV_TBL(obj)) {
	st_foreach_safe(RCLASS_IV_TBL(obj), cv_i, ary);
    }
    return ary;
}

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?
  • included_modules
  • infect_an_assertion
  • infect_with_assertions
  • initialize_copy
  • instance_method
  • instance_methods
  • method_defined?
  • module_eval
  • module_exec
  • name
  • private_class_method
  • private_instance_methods
  • private_method_defined?
  • protected_instance_methods
  • protected_method_defined?
  • psych_yaml_as
  • public_class_method
  • public_instance_method
  • public_instance_methods
  • public_method_defined?
  • rake_extension
  • rake_original_const_missing
  • remove_class_variable
  • to_s
  • yaml_as
  • Class methods
  • constants
  • nesting
  • new
  • Private methods
  • privatealias_method
  • privateappend_features
  • privateattr
  • privateattr_accessor
  • privateattr_reader
  • privateattr_writer
  • privatedefine_method
  • privateextend_object
  • privateextended
  • privateinclude
  • privateincluded
  • privatemethod_added
  • privatemethod_removed
  • privatemethod_undefined
  • privatemodule_function
  • privateprivate
  • privateprotected
  • privatepublic
  • privateremove_const
  • privateremove_method
  • privateundef_method
APIdock API Documentation Browser

© 2026 APIdock