るりまサーチ

最速Rubyリファレンスマニュアル検索!
247件ヒット [1-100件を表示] (0.051秒)
トップページ > クエリ:nil[x] > クエリ:end[x] > クラス:IO[x]

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

IO.select(reads, writes = [], excepts = [], timeout = nil) -> [[IO]] | nil (239.0)

select(2) を実行します。

...られた入力/出力/例外待ちの IO オブジェクトの中から準備ができたものを
それぞれ配列にして、配列の配列として返します。
タイムアウトした時には nil を返します。

@param reads 入力待ちする IO オブジェクトの配列を渡し...
...する IO オブジェクトの配列を渡します。

@param excepts 例外待ちする IO オブジェクトの配列を渡します。

@param timeout タイムアウトまでの時間を表す数値または nil を指定します。数値で指定したときの単位は秒です。nil を指...
...rp, wp = IO.pipe
mesg = "ping "
100.times{
rs, ws, = IO.select([rp], [wp])
if r = rs[0]
ret = r.read(5)
print ret
case ret
when /ping/
mesg = "pong\n"
when /pong/
mesg = "ping "
end

end

if w = ws[0]
w.write(mesg)
end

}

@see Kerne...

IO#internal_encoding -> Encoding | nil (130.0)

IO の内部エンコーディングを返します。 内部エンコーディングが指定されていない場合は nil を返します。

...
IO
の内部エンコーディングを返します。
内部エンコーディングが指定されていない場合は nil を返します。

//emlist[例][ruby]{
IO
.write("testfile", "abcde")
File.open("testfile") do |f|
p f.internal_encoding # => nil
f.set_encoding("ASCII-8BIT", "EUC-JP"...
...)
p f.internal_encoding # => #<Encoding:EUC-JP>
end

//}...

IO#pid -> Integer | nil (130.0)

自身が IO.popen で作られたIOポートなら、子プロセスのプロセス ID を 返します。それ以外は nil を返します。

...自身が IO.popen で作られたIOポートなら、子プロセスのプロセス ID を
返します。それ以外は nil を返します。

@raise IOError 既に close されている場合に発生します。

//emlist[例][ruby]{
IO
.popen("-") do |pipe|
if pipe
$stderr.puts "In pare...
...nt, child pid is #{pipe.pid}" # => In parent, child pid is 16013
else
$stderr.puts "In child, pid is #{$$}" # => In child, pid is 16013
end

end

//}...

IO#set_encoding_by_bom -> Encoding | nil (126.0)

BOM から IO のエンコーディングを設定します。

...BOM から IO のエンコーディングを設定します。

自身が BOM から始まる場合、BOM を読み進めて外部エンコーディングをセットし、セットしたエンコーディングを返します。
BOM が見つからなかった場合は nil を返します。

...
..., "rb") do |io|
p io.set_encoding_by_bom #=> #<Encoding:UTF-8>
str = io.read
p str #=> "abc"
p str.encoding #=> #<Encoding:UTF-8>
end


File.write("nobom.txt", "abc")
File.open("nobom.txt", "rb") do |io|
p io.set_encoding_by_bom #=> nil
end

//}...

IO#close_read -> nil (108.0)

読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。

...読み込み用の IO を close します。主にパイプや読み書き両用に作成し
IO オブジェクトで使用します。


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

@raise Errno::EXXX close に失敗した場合に発生し...
...ます。

//emlist[例][ruby]{
IO
.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end

//}

@see IO#close, IO#closed?, IO#close_write...
...読み込み用の IO を close します。主にパイプや読み書き両用に作成し
IO オブジェクトで使用します。

既に close されていた場合には単に無視されます。

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

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
IO
.popen("/bin/sh","r+") do |f|
f.close_read
# f.readlines # => IOError: not opened for reading
end

//}

@see IO#close, IO#closed?, IO#close_write...

絞り込み条件を変える

IO#close_write -> nil (108.0)

書き込み用の IO を close します。

... IO を close します。


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

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOEr...
...ror: not opened for writing
end

//}

@see IO#close, IO#closed?, IO#close_read...
... IO を close します。

既に close されていた場合には単に無視されます。

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

@raise Errno::EXXX close に失敗した場合に発生します。

//emlist[例][ruby]{
f = IO.popen...
...("/bin/sh","r+") do |f|
f.close_write
# f.print "nowhere" # => IOError: not opened for writing
end

//}

@see IO#close, IO#closed?, IO#close_read...

IO.popen("-", mode = "r", opt={}) -> IO (35.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 "child output: " + s
exit
end


...
... 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 (35.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 "child output: " + s
exit
end


...
... 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(env, "-", mode = "r", opt={}) -> IO (35.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 "child output: " + s
exit
end


...
... 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(env, "-", mode = "r", opt={}) {|io| ... } -> object (35.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 "child output: " + s
exit
end


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