singleton method PP.sharing_detection

sharing_detection -> bool[permalink][rdoc][edit]
sharing_detection=(boolean)

共有検出フラグを表すアクセサです。デフォルトは false です。true である場合、 PP.pp は一度出力したオブジェクトを再び出力する時 Object#pretty_print_cycle を使います。

[PARAM] boolean:
共有検出フラグを true か false で指定します。

b = [1, 2, 3]
a = [b, b]

pp a                        #=> [[1, 2, 3], [1, 2, 3]]

PP.sharing_detection = true
pp a                        #=> [[1, 2, 3], [...]]