Skip to content

Commit c1c442e

Browse files
Watson1978claude
andcommitted
レビュー対応: each_caller_location の版を 3.2 起点にし、モジュール関数の参照を修正
- Thread.each_caller_location は 3.2 で追加され、start / length / range の 引数を取れるようになったのは 3.4 から (3.2/3.3 で引数を渡すと ArgumentError)。 セクション全体を #@SInCE 3.4 で囲んでいたため 3.2/3.3 でメソッドごと消えていた。 メソッド自体を #@SInCE 3.2 とし、引数付きシグネチャと引数の説明だけを #@SInCE 3.4 の入れ子にした。 - シグネチャに引数があるのに - **param** が無かったので、start / length / range を Kernel?.caller_locations の記述に揃えて追加した。 - [m:Kernel#caller_locations] (3箇所) は Kernel が module_function なので /method/Kernel/i/... を指してリンク切れになる。[m:Kernel?.caller_locations] に修正した。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 13975c3 commit c1c442e

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

manual/api/_builtin/Thread.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,17 +259,30 @@ a.join
259259

260260
- **SEE** [m:Thread#run], [m:Thread#wakeup]
261261

262+
#@since 3.2
262263
#@since 3.4
263264
### def each_caller_location(start = 1, length = nil) {|location| ... } -> nil
264265
### def each_caller_location(range) {|location| ... } -> nil
266+
#@else
267+
### def each_caller_location {|location| ... } -> nil
268+
#@end
265269

266270
現在の実行スタックの各フレームを、[c:Thread::Backtrace::Location] オブジェクトと
267271
してブロックに渡します。
268272

269-
[m:Kernel#caller_locations] と似ていますが、配列を作らずにブロックへ順に
273+
[m:Kernel?.caller_locations] と似ていますが、配列を作らずにブロックへ順に
270274
渡すため、目的のフレームが見つかった時点で処理を打ち切るような用途で
271275
無駄な生成を避けられます。
272-
引数の意味は [m:Kernel#caller_locations] と同じで、渡すフレームの範囲を指定できます。
276+
#@since 3.4
277+
引数の意味は [m:Kernel?.caller_locations] と同じで、ブロックに渡すフレームの
278+
範囲を指定できます。引数を渡せるのは Ruby 3.4 以降です。
279+
280+
- **param** `start` -- 開始フレームの位置を数値で指定します。
281+
282+
- **param** `length` -- ブロックに渡すフレームの個数を指定します。
283+
284+
- **param** `range` -- ブロックに渡したいフレームの範囲を示す [c:Range] オブジェクトを指定します。
285+
#@end
273286

274287
nil を返します。
275288

@@ -284,7 +297,7 @@ end
284297
foo
285298
```
286299

287-
- **SEE** [m:Kernel#caller_locations]
300+
- **SEE** [m:Kernel?.caller_locations]
288301
#@end
289302

290303
### def DEBUG -> Integer

0 commit comments

Comments
 (0)