るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.004秒)
トップページ > クエリ:cycle[x] > 種類:ライブラリ[x]

別のキーワード

  1. _builtin cycle
  2. array cycle
  3. enumerable cycle
  4. pp pretty_print_cycle
  5. object pretty_print_cycle

検索結果

pp (13.0)

オブジェクトなどを見やすく出力するためのライブラリです。

...マイズ

あるクラスの pp の出力をカスタマイズしたい場合は、
そのクラスで pretty_print メソッドと pretty_print_cycle メソッドを再定義します。
このメソッドは PP オブジェクトを引数として pp 実行時に呼ばれます。
ユーザは表...
...e
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 => "dddddd...