るりまサーチ

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

別のキーワード

  1. socket local_creds
  2. socket af_local
  3. socket local_peercred
  4. socket pf_local
  5. socket local_connwait

ライブラリ

クラス

キーワード

検索結果

Binding#local_variables -> [Symbol] (21113.0)

ローカル変数の一覧を Symbol の配列で返します。

...カル変数の一覧を Symbol の配列で返します。

//emlist[例][ruby]{
d
ef foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}

このメソッドは以下のコードと同様の動作をします。

//emlist[][ruby]{
binding.eval("local_variables")
//}...

NameError#local_variables -> [Symbol] (18113.0)

self が発生した時に定義されていたローカル変数名の一覧を返します。

...発生した時に定義されていたローカル変数名の一覧を返します。

内部での使用に限ります。

例:

d
ef foo
begin
b = "bar"
c = 123
d

rescue NameError => err
p err.local_variables #=> [:b, :c, :err]
end
end

a = "buz"
foo...

TracePoint#binding -> Binding (6206.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...発生したイベントによって生成された Binding オブジェクトを返します。


//emlist[例][ruby]{
d
ef foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

TracePoint#binding -> Binding | nil (6206.0)

発生したイベントによって生成された Binding オブジェクトを返します。

...inding オブジェクトを返します。

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

//emlist[例][ruby]{
d
ef foo(ret)
ret
end
trace = TracePoint.new(:call) do...
...|tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}...

static VALUE rb_f_local_variables(void) (6200.0)

絞り込み条件を変える

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

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

...1 = 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_variables, Object#instance_variables, Module#con...

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

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

...や include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。

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

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

class Foo
FOO = 1
end
class Bar
BAR = 1

# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO...
...ない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []

# ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constant...

Module.constants -> [Symbol] (3006.0)

このメソッドを呼び出した時点で参照可能な定数名の配列を返します。

...//emlist[例][ruby]{
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 (12.0)

NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...いという長年のバグを修正しました。 9593

=== 組み込みクラスの更新

* Binding
* 追加: Binding#local_variables
* 追加: Binding#receiver

* Dir
* 追加: Dir#fileno

* Enumerable
* 追加: Enumerable#slice_after
* 追加: Enumerable#slice_when...
...
* 改善: メジャーGCにインクリメンタルマーキングを導入しました。 10137

* IO
* 改善: Windows上でパイプのための IO#read_nonblock, IO#write_nonblock をサポートしました。

* Kernel
* 追加: Kernel.#itself(Object#itself)
* 改善: K...
...* 追加: String#unicode_normalize
* 追加: String#unicode_normalize!
* 追加: String#unicode_normalized?

* Symbol
* 改善: String#to_sym, String#intern によって返される多くのシンボルがGC可能になりました

* Method
* 追加: Method#curry([arity]) はカ...