Skip to content

Commit a104095

Browse files
Watson1978claude
andcommitted
レビュー対応: Fiber#storage の例の出力を Hash の表記に合わせて分岐
Fiber#storage の「例: 取得」で p Fiber.current.storage # => {key: 1} としていたが、この Hash の inspect 表記は 3.4 からのもので、storage が 存在する 3.2 / 3.3 では {:key=>1} になる。同じファイルの backtrace の例と 同様に #@SInCE 3.4 / #@else で出し分けた。 3.2 / 3.3 / 3.4 / 4.0 でデータベースを生成し、3.3 以前では {:key=>1}、 3.4 以降では {key: 1} が出ることを確認済み。 追加した他の例は出力が数値・nil・bool のみで、この影響を受けない。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 75a444c commit a104095

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

manual/api/_builtin/Fiber.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,11 @@ storage= は実験的な機能です。呼び出すと実験的な機能であ
617617

618618
```ruby title="例: 取得"
619619
Fiber[:key] = 1
620+
#@since 3.4
620621
p Fiber.current.storage # => {key: 1}
622+
#@else
623+
p Fiber.current.storage # => {:key=>1}
624+
#@end
621625

622626
# 返り値は複製なので、変更しても fiber storage には影響しない
623627
Fiber.current.storage[:key] = 2

0 commit comments

Comments
 (0)