56件ヒット
[1-56件を表示]
(0.023秒)
トップページ > :PrettyPrint#group
種類
- インスタンスメソッド (34)
- ライブラリ (22)
ライブラリ
- pp (22)
- prettyprint (12)
クラス
- Object (11)
- PP (11)
- PrettyPrint (12)
キーワード
- first? (1)
- group (11)
-
object
_ group (11) - pp (11)
-
pretty
_ print (11) - prettyprint (11)
検索結果
先頭5件
-
PrettyPrint
# group(indent = 0 , open _ obj = & # 39;& # 39; , close _ obj = & # 39;& # 39; , open _ width = open _ obj . length , close _ width = close _ obj . length) { . . . } -> () (62107.0) -
与えられたブロックを実行します。 ブロック内で自身に追加される文字列やオブジェクトは、1行にまとめて表示しても よい同じグループに属すると仮定されます。
...に属すると仮定されます。
もう少し詳しく説明します。pretty printing アルゴリズムはインデントと改行を、
ツリー構造を作ることによって決定します。そして、group メソッドは子ノードの作成と
子ノードのインデントの深... -
PrettyPrint
# first? -> bool (21006.0) -
このメソッドは obsolete です。
...の呼び出しかどうかを判定する
述語です。これはカンマで区切られた値を整形するのに有用です。
pp.group(1, '[', ']') {
xxx.each {|yyy|
unless pp.first?
pp.text ','
pp.breakable
end
... pretty printing yyy ...
}
}... -
PP
# object _ group(obj) { . . . } -> () (6135.0) -
以下と等価な働きをするもので簡便のために用意されています。 group(1, '#<' + obj.class.name, '>') { ... }
...以下と等価な働きをするもので簡便のために用意されています。
group(1, '#<' + obj.class.name, '>') { ... }
@param obj 表示したいオブジェクトを指定します。
@see PrettyPrint#group... -
prettyprint (6054.0)
-
pretty printing アルゴリズムのためのライブラリです。
...pretty printing アルゴリズムのためのライブラリです。
=== 使い方
pretty printing アルゴリズムは読みやすいインデントと改行を決定するためのアルゴリズムです。
インデントと改行はユーザによって与えられたツリー構造から......作成する必要があります。
* PrettyPrint.new でバッファを生成します。このとき、バッファの幅と改行文字を指定します。
* PrettyPrint#text を使って、文字列を適宜 挿入します。
* PrettyPrint#group を使って子ノードをつくります......* PrettyPrint#breakable を使って改行しても良い場所を指定します。
同じノード内で呼ばれた breakable は、改行するならば全て同時に改行します。
//emlist[][ruby]{
require 'prettyprint'
p2 = PrettyPrint.new('', 10)
s = 'hello'
p2.text(s)
p2.group(p2.i... -
pp (270.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...@newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c98 @group=0, @tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @tail=0, @buf=[#<PrettyPrint::Text:0x81a0b30 @tail=2, @wi
dth=1, @text="[">, #<PrettyPrint::Group:0x81a0a68 @group=2, @tail=1, @buf=[#<Pre
ttyPrint::Text:0x81a09f0 @tail=1,......e_width=1>, #
<PrettyPrint::Text:0x81a0a7c @tail=0, @width=1, @text=",">, #<PrettyPrint::Break
able:0x81a0a2c @group=2, @gensace=#<Proc:0x81a0cc0>, @newline="\n", @indent=1, @
tail=2, @sep=" ", @width=1>, #<PrettyPrint::Group:0x81a09c8 @group=2, @tail=1, @
buf=[#<PrettyPrint::Text:0x81a0950......PP オブジェクトを使って以下のように作成します。
* PrettyPrint#group を使って子ノードをつくります。同時に子ノードのインデントの深さも決めます。
* PrettyPrint#breakable を使って改行しても良い場所を指定します。
* PP#... -
Object
# pretty _ print(pp) -> () (36.0) -
PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。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......@param pp PP オブジェクトです。
//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...