るりまサーチ

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

別のキーワード

  1. _builtin gets
  2. irb/input-method gets
  3. io gets
  4. argf.class gets
  5. csv gets

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#gets(rs = $/) -> String | nil (18145.0)

ARGFから一行読み込んで、それを返します。 行の区切りは引数 rs で指定した文字列になります。

...到達した時、 nil を返します。
@raise Errno::EXXX 読み込みに失敗した場合に発生します。

//emlist[main.rb][ruby]{
ARGV << 'b.txt' << 'c.txt'
p gets #=> "hello\n"
p gets(nil) #=> "it\ncommon\n"
p gets("") #=> "ARGF\n\n"
p gets('、') #=> "# スクリプトに指定した...
...引数 (Object::ARGV を参照) をファイル名と\n# みなして、"
p gets #=> "それらのファイルを連結した 1 つの仮想ファイルを表すオブジェクトです。\n"
p gets #=> nil
p readline # end of file reached (EOFError)
//}

//emlist[b.txt][ruby]{
hello
it
common
//}...

IO#gets(limit) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(limit, chomp: false) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(rs = $/) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(rs = $/, chomp: false) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

絞り込み条件を変える

IO#gets(rs, limit) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...込みバイト数

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

IO#gets(rs, limit, chomp: false) -> String | nil (18123.0)

一行読み込んで、読み込みに成功した時にはその文字列を返します。 EOF に到達した時には nil を返します。

...り除きます。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

f = File.new("oneline_file")
f.gets #=> "This is line one\n"
$_ #=> "This is line one\n"
f.gets...

Process.#getsid(pid = 0) -> Integer (6108.0)

引数 pid で指定されたプロセスのセッション ID を返します。

...@raise NotImplementedError メソッドが現在のプラットフォームで実装されて
いない場合に発生します。

Process.getsid() # => 27422
Process.getsid(0) # => 27422
Process.getsid(Process.pid()) # => 27422

@see getsi...

IO#lineno -> Integer (52.0)

現在の行番号を整数で返します。実際には IO#gets が呼ばれた回数です。 改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。

...現在の行番号を整数で返します。実際には IO#gets が呼ばれた回数です。
改行以外のセパレータで gets が呼ばれた場合など、実際の行番号と異なる場合があります。

@raise IOError 読み込み用にオープンされていなければ発生...
...します。

f = File.new("testfile")
f.lineno #=> 0
f.gets #=> "This is line one\n"
f.lineno #=> 1
f.gets #=> "This is line two\n"
f.lineno #=> 2

@see $....

IO#sysread(maxlen, outbuf = "") -> String (36.0)

read(2) を用いて入力を行ない、入力されたデータを 含む文字列を返します。stdio を経由しないので gets や getc や eof? などと混用すると思わぬ動作 をすることがあります。

...read(2) を用いて入力を行ない、入力されたデータを
含む文字列を返します。stdio を経由しないので gets や getc や eof? などと混用すると思わぬ動作
をすることがあります。

バイナリ読み込みメソッドとして動作します。

...
...に読み込んだデータのサイズになります。

@raise IOError 自身が読み込み用にオープンされていなければ発生します。

@raise EOFError IO が既に EOF に達していれば発生します。

@raise Errno::EXXX データの読み込みに失敗した場合に...

絞り込み条件を変える

IO.popen("-", mode = "r", opt={}) -> IO (35.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...では
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end

ブロックを与えられた場合、親プロセス...
...にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"

opt ではエンコーディングの設定やプロセ...
...ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生成に失敗した場合に発生します。...

IO.popen("-", mode = "r", opt={}) {|io| ... } -> object (35.0)

第一引数に文字列 "-" が指定された時、fork(2) を 行い子プロセスの標準入出力との間にパイプラインを確立します。 親プロセスでは IO オブジェクトを返し、子プロセスでは nil を返します。

...では
nil を返します。

io = IO.popen("-", "r+")
if io # parent
io.puts "foo"
p io.gets # => "child output: foo\n"
io.close
else # child
s = gets
print "child output: " + s
exit
end

ブロックを与えられた場合、親プロセス...
...にブロックを実行し終了します。

p IO.popen("-", "r+") {|io|
if io # parent
io.puts "foo"
io.gets
else # child
s = gets
puts "child output: " + s
end
}
# => "child output: foo\n"

opt ではエンコーディングの設定やプロセ...
...ポートのモードを指定します。mode の詳細は Kernel.#open 参照して下さい。
@param opt エンコーディングなどを設定するオプション引数(see IO.new)

@raise Errno::EXXX パイプ、あるいは子プロセスの生成に失敗した場合に発生します。...
<< 1 2 3 ... > >>