るりまサーチ

最速Rubyリファレンスマニュアル検索!
36件ヒット [1-36件を表示] (0.121秒)
トップページ > 種類:インスタンスメソッド[x] > クエリ:kernel[x] > クエリ:y[x] > クエリ:ruby[x] > クエリ:instance_variables[x]

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

Object#instance_variables -> [Symbol] (18226.0)

オブジェクトのインスタンス変数名をシンボルの配列として返します。

...をシンボルの配列として返します。

//emlist[][ruby]{
obj = Object.new
obj.instance_eval { @foo, @bar = nil }
p obj.instance_variables

#=> [:@foo, :@bar]
//}

@see Object#instance_variable_get, Kernel.#local_variables, Kernel.#global_variables, Module.constants, Module#constants, Modu...

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

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

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

@see Module.constants, Kernel.#local_variables, Kernel.#global_variable...

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

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

...した場合 対象にはなりません。

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

//emlist[Module.constants と Module#constants の違い][ruby]{
# 出力の簡略化のため起動時の定数一覧を取得し...