Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > ppライブラリ > PPクラス > sharing_detection
sharing_detection -> bool
[permalink][rdoc]sharing_detection=(boolean)
共有検出フラグを表すアクセサです。デフォルトは false です。true である場合、 PP.pp は一度出力したオブジェクトを再び出力する時 Object#pretty_print_cycle を使います。
require 'pp'
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1, 2, 3], [...]]