るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

tracer (38054.0)

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

...ruby -rtracer hoge.rb

もうひとつはソースからrequireする方法です。

require 'tracer'

とした後

Tracer
.on

によりトレース出力を有効にします。

Tracer
.off

によりトレース出力を無効にします。

また、ブロック付きで Tracer.on を...
...
require 'tracer'

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...

NEWS for Ruby 2.7.0 (48.0)

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

...Numbered parameters)がデフォルトのブロックの仮引数として
導入されました。 4475

//emlist[][ruby]{
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
//}

* 「_1」などはまだローカル変数名として使えて...
...た。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}

* Enumerator
*...
...はruby-coreでの変更のみで、まだrubygems.orgでは公開されていません。
* monitor
* observer
* timeout
* tracer
* uri
* yaml
* did_you_mean gemはbundled gemからdefault gemになりました。

* pathname
* Kernel#PathnameをPathname...

irb (30.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...t
非常にシンプルなプロンプトを用いるモード。
--noprompt プロンプトを表示しない。
--tracer コマンド実行時にトレースする。
--back-trace-limit n
バックトレース表示をバックトレー...
...ULT
IRB.conf[:SINGLE_IRB] = false
IRB.conf[:SAVE_HISTORY] = nil
IRB.conf[:USE_LOADER] = true
IRB.conf[:USE_READLINE] = nil
IRB.conf[:USE_TRACER] = true
IRB.conf[:VERBOSE] = true

それぞれの設定値の詳細については、IRB::Context を参照してください。

====[a:custom...
...な記法は以下の通りです。

: %N
起動しているコマンド名(IRB::Context#irb_name)
: %m
main オブジェクト (self) を to_s した文字列
: %M
main オブジェクト (self) を inspect した文字列
: %l
文字列中のタイプを表す (", ', /, ], `]'は%...
...LT
IRB.conf[:SINGLE_IRB] = false
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:USE_LOADER] = true
IRB.conf[:USE_READLINE] = nil
IRB.conf[:USE_TRACER] = true
IRB.conf[:VERBOSE] = true

それぞれの設定値の詳細については、IRB::Context を参照してください。

====[a:custom...

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

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

...る度に、以下で説明する6個の引数とともに
登録された Proc オブジェクトを実行します。

標準添付の debug、tracer
profile はこの組み込み関数を利用して実現されています。

=== ブロックパラメータの意味

渡す Proc オブジェ...
...レースをオフにします。

@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...