るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.082秒)

別のキーワード

  1. kernel spawn
  2. kernel system
  3. kernel exec
  4. kernel open
  5. kernel caller

ライブラリ

クラス

キーワード

検索結果

ARGF.class#print(*arg) -> nil (21114.0)

引数を順に処理対象のファイルに出力します。

...引数を順に処理対象のファイルに出力します。

c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#print と同じです。

@param arg 出力するオブジェクトを任意個指定します。...

ARGF.class#printf(format, *arg) -> nil (9107.0)

C 言語の printf と同じように、format に従い引数を 文字列に変換して処理対象のファイルに出力します。

... printf と同じように、format に従い引数を
文字列に変換して処理対象のファイルに出力します。

c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は出力先を指定しない形式の Kernel.#print...

Object#pretty_print(pp) -> () (6148.0)

PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。

...PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト 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, Obje...
...ct#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable...
..._print メソッドを定義しています。

@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...

Object#to_s -> String (49.0)

オブジェクトの文字列表現を返します。

...

Kernel
.#print Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。

//emlist[][ruby]{
class
Foo
def initialize num
@num = num
end
end
it = Foo.new(40)

puts it #=> #<Foo:0x2b69110>

class
Foo...
...def to_s
"Class:Foo Number:#{@num}"
end
end

puts it #=> Class:Foo Number:40
//}

@see Object#to_str,Kernel.#String...