種類
- インスタンスメソッド (60)
- 特異メソッド (36)
- モジュール関数 (4)
モジュール
- Kernel (4)
キーワード
- pp (4)
-
pretty
_ inspect (12) -
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
pretty
_ print _ inspect (12) -
pretty
_ print _ instance _ variables (12) -
sharing
_ detection (12) -
sharing
_ detection= (12) -
singleline
_ pp (12)
検索結果
先頭5件
-
Object
# pretty _ inspect -> String (6102.0) -
self を pp で表示したときの結果を文字列として返します。
...self を pp で表示したときの結果を文字列として返します。... -
Object
# pretty _ print(pp) -> () (6102.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
...
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。
あるクラスの pp の出力をカスタマイズしたい場合は、このメソッドを再定義します。
そのと......tty_print メソッドは指定された pp に対して表示したい自身の内容を追加して
いかなければいけません。いくつかの組み込みクラスについて、
pp ライブラリはあらかじめ pretty_print メソッドを定義しています。
@param pp PP オブ......ジェクトです。
//emlist[][ruby]{
require 'pp'
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable......ジェクトです。
//emlist[][ruby]{
class Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}
@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable... -
Object
# pretty _ print _ cycle(pp) -> () (6102.0) -
プリティプリント時にオブジェクトの循環参照が検出された場合、 Object#pretty_print の代わりに呼ばれるメソッドです。
...#pretty_print の代わりに呼ばれるメソッドです。
あるクラスの pp の出力をカスタマイズしたい場合は、
このメソッドも再定義する必要があります。
@param pp PP オブジェクトです。
//emlist[][ruby]{
class Array
def pretty_print_cycle(q)......q.text(empty? ? '[]' : '[...]')
end
end
//}
@see Object#pretty_print... -
Object
# pretty _ print _ inspect -> String (6102.0) -
Object#pretty_print を使って Object#inspect と同様に オブジェクトを人間が読める形式に変換した文字列を返します。
...t#pretty_print を使って Object#inspect と同様に
オブジェクトを人間が読める形式に変換した文字列を返します。
出力する全てのオブジェクトに Object#pretty_print が定義されている必要があります。
そうでない場合には RuntimeError......が発生します。
@raise RuntimeError 出力する全てのオブジェクトに Object#pretty_print が定義されて
いない場合に発生します。... -
Object
# pretty _ print _ instance _ variables -> [String | Symbol] (6102.0) -
プリティプリント時に表示すべき自身のインスタンス変数名の配列をソートして返します。 返されたインスタンス変数はプリティプリント時に表示されます。
...表示すべき自身のインスタンス変数名の配列をソートして返します。
返されたインスタンス変数はプリティプリント時に表示されます。
pp に表示したくないインスタンス変数がある場合にこのメソッドを再定義します。... -
PP
. sharing _ detection -> bool (6102.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 は一度出力したオブジェクトを再び出力する時
Object#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sh......aring_detection = true
pp a #=> [[1, 2, 3], [...]]
//}... -
PP
. sharing _ detection=(boolean) (6102.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 は一度出力したオブジェクトを再び出力する時
Object#pretty_print_cycle を使います。
@param boolean 共有検出フラグを true か false で指定します。
//emlist[][ruby]{
b = [1, 2, 3]
a = [b, b]
pp a #=> [[1, 2, 3], [1, 2, 3]]
PP.sh......aring_detection = true
pp a #=> [[1, 2, 3], [...]]
//}... -
PP
. singleline _ pp(obj , out= $ >) -> object (6102.0) -
指定されたオブジェクト obj を出力先 out に出力します。 ただし、インデントも改行もしません。 出力先 out を返します。
指定されたオブジェクト obj を出力先 out に出力します。
ただし、インデントも改行もしません。
出力先 out を返します。
@param obj 表示したいオブジェクトを指定します。
@param out 出力先を指定します。<< メソッドが定義されている必要があります。 -
Kernel
. # pp(*obj) -> object (3002.0) -
指定されたオブジェクト obj を標準出力に見やすい形式(プリティプリント)で出力します。 obj それぞれを引数として PP.pp を呼ぶことと同等です。
... PP.pp を呼ぶことと同等です。
@param obj 表示したいオブジェクトを指定します。
//emlist[例][ruby]{
require 'pp'
b = [1, 2, 3] * 4
a = [b, b]
a << a
pp a
#=> [[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
# [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
# [...]]
//}
@see PP.pp...