るりまサーチ

最速Rubyリファレンスマニュアル検索!
708件ヒット [201-300件を表示] (0.031秒)
トップページ > クラス:IO[x] > クエリ:new[x]

別のキーワード

  1. openssl new
  2. _builtin new
  3. rexml/document new
  4. resolv new
  5. socket new

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

IO#each(rs, limit, chomp: false) -> Enumerator (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each(rs, limit, chomp: false) {|line| ... } -> self (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each_line(limit, chomp: false) -> Enumerator (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each_line(limit, chomp: false) {|line| ... } -> self (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each_line(rs = $/, chomp: false) -> Enumerator (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

絞り込み条件を変える

IO#each_line(rs = $/, chomp: false) {|line| ... } -> self (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each_line(rs, limit, chomp: false) -> Enumerator (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#each_line(rs, limit, chomp: false) {|line| ... } -> self (19.0)

IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。

...
IO
の現在位置から 1 行ずつ文字列として読み込み、それを引数として
与えられたブロックを実行します。

ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。

テキスト読み込みメソ...
...を取り除きます。

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

//emlist[例: 引数なし][ruby]{
IO
.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "...
...ist[例: 行の区切りに半角カンマ、最大読み取りバイト数に 10 を指定][ruby]{
IO
.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one...

IO#eof -> bool (19.0)

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

...します。

f = File.new("testfile")
dummy = f.readlines
f.eof #=> true

自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。

r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eo...
...ue を返す。

r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。

r, w = IO.pipe
r.eof? # 永久にブロックします。

eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時に使...
...うと正常に
動作しません。

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

IO#eof? -> bool (19.0)

ストリームがファイルの終端に達した場合、true を返します。そうでない場合、false を返します。

...します。

f = File.new("testfile")
dummy = f.readlines
f.eof #=> true

自身がパイプやソケットなどのストリームであった場合、相手がデータを送るか close するまでブロックします。

r, w = IO.pipe
Thread.new { sleep 10; w.close }
r.eo...
...ue を返す。

r, w = IO.pipe
Thread.new { sleep 10; w.puts "a" }
r.eof? #=> 10秒ブロックしてから false を返す。

r, w = IO.pipe
r.eof? # 永久にブロックします。

eof, eof? は入力バッファにデータを読み込むので、IO#sysread と同時に使...
...うと正常に
動作しません。

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

絞り込み条件を変える

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

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

...ンを確立します。
親プロセスでは IO オブジェクトを返し、子プロセスでは
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...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

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 ではエンコーディングの設定やプロセス起動のためのオプションが指定できます。
IO
.new や Kernel.#spa...

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

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

...ンを確立します。
親プロセスでは IO オブジェクトを返し、子プロセスでは
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...
... IO オブジェクトを引数に
ブロックを実行し、その結果を返します。ブロックの実行後、生成したパイ
プは自動的にクローズされます。
子プロセスでは nil を引数にブロックを実行し終了します。

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 ではエンコーディングの設定やプロセス起動のためのオプションが指定できます。
IO
.new や Kernel.#spa...
<< < 1 2 3 4 5 ... > >>