75件ヒット
[1-75件を表示]
(0.053秒)
別のキーワード
種類
- インスタンスメソッド (42)
- モジュール関数 (22)
- 特異メソッド (11)
クラス
- Module (22)
- NameError (9)
- Object (11)
- TracePoint (11)
モジュール
- Kernel (22)
キーワード
- binding (11)
- constants (22)
-
global
_ variables (11) -
instance
_ variables (11)
検索結果
先頭5件
-
Kernel
. # local _ variables -> [Symbol] (18115.0) -
現在のスコープで定義されているローカル変数名の配列を返します。
...現在のスコープで定義されているローカル変数名の配列を返します。
//emlist[例][ruby]{
yuyu = 0
p local_variables #=> [:yuyu]
//}
@see Kernel.#global_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
NameError
# local _ variables -> [Symbol] (18115.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... -
TracePoint
# binding -> Binding (3014.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
...発生したイベントによって生成された Binding オブジェクトを返します。
//emlist[例][ruby]{
def 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 (3014.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
...は binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}... -
Module
# constants(inherit = true) -> [Symbol] (32.0) -
そのモジュール(またはクラス)で定義されている定数名の配列を返します。
...されません。
@param inherit true を指定するとスーパークラスや include したモジュールで
定義された定数が対象にはなります。false を指定した場合 対象にはなりません。
@see Module.constants, Kernel.#local_variables, Kernel.#global_var......nd
class Bar
BAR = 1
# Bar は BAR を含む
p constants # => [:BAR]
# 出力に FOO は含まれない
p Module.constants - $clist # => [:BAR, :Bar, :Foo]
class Baz
# Baz は定数を含まない
p constants # => []
#......ネストしたクラスでは、外側のクラスで定義した定数は
# 参照可能なので、BAR は、Module.constants には含まれる
# (クラス Baz も Bar の定数なので同様)
p Module.constants - $clist # => [:BAR, :Baz, :Foo, :Bar]
end
end
//}... -
Kernel
. # global _ variables -> [Symbol] (14.0) -
プログラム中で定義されているグローバル変数(`$'で始まる変数)名の 配列を返します。
...グラム中で定義されているグローバル変数(`$'で始まる変数)名の
配列を返します。
//emlist[例][ruby]{
p global_variables #=> [:$;, :$-F, :$@, ... ]
//}
@see Kernel.#local_variables,Object#instance_variables,Module.constants,Module#constants,Module#class_variables... -
Module
. constants -> [Symbol] (14.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... -
Object
# instance _ variables -> [Symbol] (14.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, Module#class_variables...