るりまサーチ

最速Rubyリファレンスマニュアル検索!
365件ヒット [1-100件を表示] (0.126秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

GC::Profiler.enable -> nil (29209.0)

GC のプロファイラを起動します。

...GC のプロファイラを起動します。

このメソッドを呼び出してから GC が発生すると、
GC についてプロファイル情報を取得します。

例:
GC::Profiler.enable
GC::Profiler.enabled? #=> true

@see GC::Profiler.disable, GC::Profiler.enabled?...

TracePoint#enable -> bool (29128.0)

self のトレースを有効にします。

...TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)

# トレースが有効

trace.enabled? # =...
...rue
trace.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace.enabled? # =>...
...trace.enable do
trace.enabled? # => true
end

trace.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace.enable { p trace.lineno }...

TracePoint#enable { ... } -> object (29128.0)

self のトレースを有効にします。

...TracePoint#enabled? を返します。(トレースが既に有効であっ
た場合は true を返します。そうでなければ false を返します)

//emlist[例][ruby]{
trace.enabled? # => false
trace.enable # => false (実行前の状態)

# トレースが有効

trace.enabled? # =...
...rue
trace.enable # => true (実行前の状態)

# 引き続きトレースが有効
//}

ブロックが与えられた場合、ブロック内でのみトレースが有効になります。
この場合はブロックの評価結果を返します。

//emlist[例][ruby]{
trace.enabled? # =>...
...trace.enable do
trace.enabled? # => true
end

trace.enabled? # => false
//}

[注意] イベントフックのためのメソッドにブロックの外側で参照した場合は
RuntimeError が発生する事に注意してください。

//emlist[例][ruby]{
trace.enable { p trace.lineno }...

TracePoint#binding -> Binding (23408.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 (23408.0)

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

...れた Binding オブジェクトを返します。

C で記述されたメソッドは 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
//}...

絞り込み条件を変える

TracePoint#inspect -> String (17208.0)

self の状態を人間に読みやすい文字列にして返します。

...self の状態を人間に読みやすい文字列にして返します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//}...

TracePoint#instruction_sequence -> RubyVM::InstructionSequence (17208.0)

script_compiledイベント発生時にコンパイルされた RubyVM::InstructionSequenceインスタンスを返します。

...script_compiledイベント発生時にコンパイルされた
RubyVM::InstructionSequenceインスタンスを返します。

//emlist[例][ruby]{
TracePoint.new(:script_compiled) do |tp|
p tp.instruction_sequence # => <RubyVM::InstructionSequence:block in <main>@(eval):1>
end.enable do
eval...
...("puts 'hello'")
end
//}

@raise RuntimeError :script_compiled イベントのための
イベントフックの外側で実行した場合に発生します。...

TracePoint#lineno -> Integer (17208.0)

発生したイベントの行番号を返します。

...発生したイベントの行番号を返します。

@raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call, :return) do |tp|
tp.lineno
end
trace.enable
foo 1
# => 1
# 3
//}...

TracePoint#defined_class -> Class | module (17120.0)

メソッドを定義したクラスかモジュールを返します。

...す。

//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}

メソッドがモジュールで定義されていた場合も(include に関係なく)モジュー
ルを返します。

//emlist[例][ruby]...
...{
module M; def foo; end; end
class C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}

[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、Kernel.#set_trace_fun...
...スではなく元のクラスを返します。

//emlist[例][ruby]{
class C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}

Kernel.#set_trace_func と TracePoint の上記の差分に注意して
ください。

@s...

GC::Profiler.enabled? -> bool (17114.0)

GC のプロファイラを起動中であれば true、停止中であれば false を返します。

...プロファイラを起動中であれば true、停止中であれば false を返します。

例:
GC::Profiler.enabled? #=> false
GC::Profiler.enable
GC::Profiler.enabled? #=> true
GC::Profiler.disable
GC::Profiler.enabled? #=> false

@see GC::Profiler.enable, GC::Profiler.disable...

絞り込み条件を変える

TracePoint#enabled? -> bool (17108.0)

self のトレースが有効な場合に true を、そうでない場合に false を返しま す。

...self のトレースが有効な場合に true を、そうでない場合に false を返しま
す。


@see TracePoint#enable, TracePoint#disable...
<< 1 2 3 ... > >>