22件ヒット
[1-22件を表示]
(0.071秒)
別のキーワード
検索結果
-
PP
. sharing _ detection -> bool (18208.0) -
共有検出フラグを表すアクセサです。 デフォルトは false です。true である場合、 PP.pp は一度出力したオブジェクトを再び出力する時 Object#pretty_print_cycle を使います。
...le を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
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], [...]]
//}......etty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sharing_detection = true
pp a #=> [[1, 2, 3], [...]]
//}... -
pp (24.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...、Kernel.#pp を使う上で余計な作業をする
必要はありません。
=== どちらが読みやすいでしょうか?
p による pretty-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c9......ne_w
idth=1>, #<PrettyPrint::Text:0x81a0af4 @tail=0, @width=1, @text="]">], @singleli
ne_width=6>], @singleline_width=6>, @sharing_detection=false>
pp による pretty-print された出力:
#<PP:0x40d0688
@buf=
#<PrettyPrint::Group:0x40d064c
@buf=
[#<PrettyPrint::Group:0x40......@tail=0>],
@group=0,
@singleline_width=6,
@tail=0>,
@genspace=#<Proc:0x40d0656>,
@nest=[0],
@newline="\n",
@sharing_detection=false,
@stack=[]>
=== 出力のカスタマイズ
あるクラスの pp の出力をカスタマイズしたい場合は、
そのク...