remove_class_variable(name) -> object[permalink][rdoc][edit]-
引数で指定したクラス変数を取り除き、そのクラス変数に設定されていた値を返します。
- [PARAM]
name: - String または Symbol を指定します。
- [RETURN]
- 引数で指定されたクラス変数に設定されていた値を返します。
- [EXCEPTION]
NameError: - 引数で指定されたクラス変数がそのモジュールやクラスに定義されていない場合に発生します。
class Counter @@count = 1 p remove_class_variable(:@@count) # => 1 @@count # => uninitialized class variable @@count in Counter (NameError) end[SEE_ALSO] Module#remove_const, Object#remove_instance_variable
- [PARAM]