るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

Thread#set_trace_func(pr) -> Proc | nil (18149.0)

スレッドにトレース用ハンドラを設定します。

...

設定したハンドラを返します。

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-ca...
...# => ["line", "example.rb", 4, nil, #<Binding:0x00007fc8de88c440>, nil]
# => ["c-call", "example.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>...
..."c-return", "example.rb", 5, :current, #<Binding:0x00007fc8de9673b0>, Thread]
# => ["c-call", "example.rb", 5, :set_trace_func, #<Binding:0x00007fc8de966fc8>, Thread]
//}

@param pr トレースハンドラ(Proc オブジェクト) もしくは nil
@see Thread#add_trace_func Kernel.#set_trace_func...

Kernel.#set_trace_func(proc) -> Proc (18131.0)

Ruby インタプリタのイベントをトレースする Proc オブジェクトとして 指定された proc を登録します。 nil を指定するとトレースがオフになります。

...レースをオフにします。

@return proc を返します。

//emlist[例][ruby]{
set_trace_func
lambda {|*arg|
p arg
}
class Foo
end
43.to_s

# ----結果----
# ["c-return", "..", 1, :set_trace_func, #<Binding:0xf6ceb8>, Kernel]
# ["line", "..", 4, nil, #<Binding:0x10cbcd8>, nil]
# ["c-cal...
...["class", "..", 4, nil, #<Binding:0x10cb600>, nil]
# ["end", "..", 5, nil, #<Binding:0x10cb3f0>, nil]
# ["line", "..", 6, nil, #<Binding:0x10cb1e0>, nil]
# ["c-call", "..", 6, :to_s, #<Binding:0x10cafd0>, Fixnum]
# ["c-return", "..", 6, :to_s, #<Binding:0x10cad78>, Fixnum]
//}

@see Kernel.#caller...

NEWS for Ruby 2.0.0 (36.0)

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

...たときの名前ではなく呼び出したときの名前を返します。
* 非互換: Object#inspect は #to_s を呼び出さなくなりました。再定義された #to_s を呼び出すためです。

* LoadError
* 追加: LoadError#path ロードできなかったファイル...
...ThreadError を発生させます

* Time
* 返り値変更:
* Time#to_s now returns US-ASCII encoding instead of BINARY.

* TracePoint
* new class. This class is replacement of set_trace_func.
Easy to use and efficient implementation.

* toplevel
* added method:...
...words
* Shellwords#shellescape 与えられたオブジェクトを to_s で文字列化するようになりました
* Shellwords#shelljoin 与えられた配列に含まれる文字列でないオブジェクトは to_s で文字列化するようになりました

* stringio
* 非...

Thread#add_trace_func(pr) -> Proc (30.0)

スレッドにトレース用ハンドラを追加します。

...を返します。

@param pr トレースハンドラ(Proc オブジェクト)

//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join

# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "exampl...
...e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x00007f98e108d4b0>, nil]
# => ["c-call", "example.rb", 6, :to_s, #<Binding:0x00007f98e1097aa0>, Integer]
# => ["c-return", "example.rb", 6, :to_s, #<Binding:0x00007f98e1095cc8>, Integer]
//}

@see Thread#set_trace_func Kernel.#set_trace_func...

tracer (12.0)

実行トレース出力をとる機能を提供します。

...class Hoge
def Hoge.fuga(i)
"fuga #{i}"
end
end

Tracer.add_filter {|event, file, line, id, binding, klass|
event =~ /line/ and klass.to_s =~ /hoge/i
}
Tracer.on
for i in 0..3
puts Hoge.fuga(i) if i % 3 == 0
end
Tracer.off

=== SEE ALSO

Kernel.#set_trace_func...

絞り込み条件を変える