56件ヒット
[1-56件を表示]
(0.022秒)
トップページ >
:local_variables

![条件を削除 [x]](/images/drop-condition-icon.png)
別のキーワード
種類
- インスタンスメソッド (27)
- モジュール関数 (12)
- 関数 (6)
- 特異メソッド (6)
- 文書 (5)
ライブラリ
- ビルトイン (45)
モジュール
- Kernel (12)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (5) -
class
_ variables (6) - constants (12)
-
global
_ variables (6) -
instance
_ variables (6) -
rb
_ f _ local _ variables (6)
検索結果
先頭5件
-
Binding
# local _ variables -> [Symbol] (18113.0) -
ローカル変数の一覧を Symbol の配列で返します。
...ます。
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
このメソッドは以下のコードと同様の動作をします。
binding.eval("local_variables")... -
Kernel
. # local _ variables -> [Symbol] (18107.0) -
現在のスコープで定義されているローカル変数名の配列を返します。
...現在のスコープで定義されているローカル変数名の配列を返します。
yuyu = 0
p local_variables #=> [:yuyu]
@see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
NameError
# local _ variables -> [Symbol] (18107.0) -
self が発生した時に定義されていたローカル変数名の一覧を返します。
...発生した時に定義されていたローカル変数名の一覧を返します。
内部での使用に限ります。
例:
def foo
begin
b = "bar"
c = 123
d
rescue NameError => err
p err.local_variables #=> [:b, :c, :err]
end
end
a = "buz"
foo... -
static VALUE rb
_ f _ local _ variables(void) (6100.0) -
-
Kernel
. # global _ variables -> [Symbol] (6.0) -
プログラム中で定義されているグローバル変数(`$'で始まる変数)名の 配列を返します。
...るグローバル変数(`$'で始まる変数)名の
配列を返します。
p global_variables #=> [:$;, :$-F, :$@, ... ]
@see Kernel.#local_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
Module
# class _ variables(inherit = true) -> [Symbol] (6.0) -
クラス/モジュールに定義されているクラス変数の名前の配列を返します。
...s 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_variables, Object#instance_variables, Module#constants... -
Module
# constants(inherit = true) -> [Symbol] (6.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@see Module.constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables
Module.constants と Module#constants の違い
# 出力の... -
Module
. constants -> [Symbol] (6.0) -
このメソッドを呼び出した時点で参照可能な定数名の配列を返します。
...返します。
class C
FOO = 1
end
p Module.constants # => [:RUBY_PLATFORM, :STDIN, ..., :C, ...]
# 出力中に :FOO は現われない
@see Module#constants, Kernel.#local_variables, Kernel.#global_variables, Object#instance_variables, Module#class_variables... -
NEWS for Ruby 2
. 2 . 0 (6.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...セスできないという長年のバグを修正しました。 9593
=== 組み込みクラスの更新
* Binding
* 追加: Binding#local_variables
* 追加: Binding#receiver
* Dir
* 追加: Dir#fileno
* Enumerable
* 追加: Enumerable#slice_after
* 追加: Enumerabl... -
Object
# instance _ variables -> [Symbol] (6.0) -
オブジェクトのインスタンス変数名をシンボルの配列として返します。
...の配列として返します。
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, Module#class_variables...