るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.038秒)
トップページ > クエリ:@[x] > バージョン:2.2.0[x] > クエリ:h[x] > ライブラリ:pp[x] > 種類:特異メソッド[x]

別のキーワード

  1. _builtin to_h
  2. env to_h
  3. hash to_h
  4. array to_h
  5. struct to_h

クラス

キーワード

検索結果

PP.sharing_detection -> bool (18328.0)

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

...true である場合、
PP
.pp は一度出力したオブジェクトを再び出力する時
Object#pretty_print_cycle を使います。

@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], [...]]
//}...

PP.sharing_detection=(boolean) (18328.0)

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

...true である場合、
PP
.pp は一度出力したオブジェクトを再び出力する時
Object#pretty_print_cycle を使います。

@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], [...]]
//}...

PP.pp(obj, out = $>, width = 79) -> object (382.0)

指定されたオブジェクト obj を出力先 out に幅 width で出力します。 出力先 out を返します。

...< メソッドが定義されている必要があります。

@param width 出力先の幅を指定します。

//emlist[][ruby]{
require 'pp'

str = PP.pp(b], [:a, [[:a, [:a, [:a, :b], [:a, :b],]]], '', 20)
puts str
# =>
# [[:a, :b],
# [:a,
# [[:a,
# [:a, [:a, :b]]],
# [:a, :b]]]]
//}...