るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.139秒)
トップページ > クエリ:i[x] > クエリ:h[x] > クエリ:class_variables[x]

別のキーワード

  1. _builtin to_h
  2. hash to_h
  3. struct to_h
  4. env to_h
  5. array to_h

ライブラリ

クラス

検索結果

Module#class_variables(inherit = true) -> [Symbol] (24319.0)

クラス/モジュールに定義されているクラス変数の名前の配列を返します。

...am inherit false を指定しない場合はスーパークラスやインクルードして
いるモジュールのクラス変数を含みます。

//emlist[例][ruby]{
class One
@@var1 = 1
end
class Two < One
@@var2 = 2
end
One.class_variables # => [:@@var1]
Two.class_variab...
...les # => [:@@var2, :@@var1]
Two.class_variables(false) # => [:@@var2]
//}

@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#constants...

Module#constants(inherit = true) -> [Symbol] (206.0)

そのモジュール(またはクラス)で定義されている定数名の配列を返します。

...そのモジュール(またはクラス)で定義されている定数名の配列を返します。

i
nherit に真を指定すると
スーパークラスやインクルードしているモジュールの定数も含みます。
Object のサブクラスの場合、Objectやそのスーパー...
...param inherit true を指定するとスーパークラスや include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。

@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instan...
...ce_variables, Module#class_variables

//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得して後で差し引く
$clist = Module.constants

class Foo
FOO = 1
end
class Bar
BAR = 1

# Bar は BAR を含む
p constant...