11件ヒット
[1-11件を表示]
(0.384秒)
検索結果
先頭1件
-
pp (25.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...">], @singleline_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=
[#<PrettyPri......0656>,
@nest=[0],
@newline="\n",
@sharing_detection=false,
@stack=[]>
=== 出力のカスタマイズ
あるクラスの pp の出力をカスタマイズしたい場合は、
そのクラスで pretty_print メソッドと pretty_print_cycle メソッドを再定義します。
こ......else
q.pp v
end
end
first = false
}
end
q.breakable
q.text "</hash>"
end
def pretty_print_cycle(q)
q.text(empty? ? '{}' : '{...}')
end
end
h = {:a => 'a'*5, :b => 'b'*10, :c => 'c'*20, :d => 'd'*30}
pp h
#=>
# <hash>
# :d =>...