198件ヒット
[1-100件を表示]
(0.068秒)
別のキーワード
ライブラリ
- ビルトイン (198)
クラス
-
ARGF
. class (12) - Dir (92)
- IO (84)
-
Thread
:: SizedQueue (10)
検索結果
先頭5件
-
Thread
:: SizedQueue # close -> self (18265.0) -
キューを close します。詳しくは Thread::Queue#close を参照してください。
...ーを close します。詳しくは Thread::Queue#close を参照してください。
Thread::Queue とはキューにオブジェクトを追加するスレッドの動作が
異なります。キューにオブジェクトを追加するスレッドを待機している場合は
ClosedQueueErr......or が発生して中断されます。
//emlist[例][ruby]{
q = SizedQueue.new(4)
[:resource1, :resource2, :resource3, nil].each { |r| q.push(r) }
q.closed? # => false
q.close
q.closed? # => true
//}
@see Thread::Queue#close... -
ARGF
. class # close -> self (18245.0) -
現在開いている処理対象のファイルをクローズします。開くファイルが残って いる場合は次のファイルをオープンします。 ただし、標準入力はクローズされません。
..."bar" > bar
$ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.close
ARGF.filename # => "bar"
ARGF.close
ARGF.close # => closed stream (IOError)
@raise IOError 処理対象のファイルが既にクローズされていた場合に発生します。
@see ARGF.class#closed?......いる場合は次のファイルをオープンします。
ただし、標準入力はクローズされません。
$ echo "foo" > foo
$ echo "bar" > bar
$ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.close
ARGF.filename # => "bar"
ARGF.close
@see ARGF.class#closed?... -
IO
# close -> nil (18174.0) -
入出力ポートをクローズします。
...ます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。
@raise Errno::EXXX close に失敗した場合に発生します。
@raise IOError 既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write(......"testfile", "test")
f = File.open("testfile")
f.read # => "test"
f.close
# f.read # => IOError (すでに close しているので read できない)
//}
@see IO#closed?, IO#close_read, IO#close_write......れます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。
既に close されていた場合には単に無視されます。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
IO.write(... -
IO
# closed? -> bool (6171.0) -
self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。
...
self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。
そうでない場合は false を返します。
//emlist[例][ruby]{
IO.write("testfile", "test")
f = File.new("testfile")
f.close # => nil
f.closed? # => tr......ue
f = IO.popen("/bin/sh","r+")
f.close_write # => nil
f.closed? # => false
f.close_read # => nil
f.closed? # => true
//}
@see IO#close, IO#close_read, IO#close_write... -
IO
# reopen(path) -> self (161.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パスを開く際のモードを文字列で指定します。
@raise Errno::EXXX 失敗し......します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r")......# => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
IO
# reopen(path , mode) -> self (161.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...数を省略したとき self のモードをそのまま引き継ぎます。
IO#pos, IO#lineno などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パスを開く際のモードを文字列で指定します。
@raise Errno::EXXX 失敗し......します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis is line two\n")
f1 = File.new("testfile", "a+")
f2 = File.new("testfile")
f1.print("This is line three\n")
f2.readlines # => ["This is line one\n", "This is line two\n"]
f1.close
f2.reopen("testfile", "r")......# => #<File:testfile>
f2.readlines # => ["This is line one\n", "This is line two\n", "This is line three\n"]
f2.close
//}
@see Kernel.#open... -
Dir
# each _ child {|item| . . . } -> self (144.0) -
ディレクトリの "." と ".." をのぞく各エントリを表す文字列を引数として、 ブロックを評価します。
...合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に self が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each_child{|f|
p f
}
#=> "bar"
# "foo"
//}
@see Dir#each
@see Dir.each_child... -
Dir
# each {|item| . . . } -> self (132.0) -
ディレクトリの各エントリを表す文字列を引数として、ブロックを評価します。
...場合、各エントリを文字列として保持する
Enumerator
オブジェクトを返します。
@raise IOError 既に自身が close している場合に発生します。
//emlist[例][ruby]{
Dir.open('.').each{|f|
p f
}
#=> "."
# ".."
# "bar"
# "foo"
//}
@see Dir#each_child... -
Dir
# seek(pos) -> self (132.0) -
ディレクトリストリームの読み込み位置を pos に移動させます。 pos は Dir#tell で与えられた値でなければなりま せん。
...os は Dir#tell で与えられた値でなければなりま
せん。
@param pos 変更したい位置を整数で与えます。
@raise IOError 既に自身が close している場合に発生します。
//emlist[例][ruby]{
Dir.open("testdir") do |d|
d.read # => "."
i... -
IO
# reopen(io) -> self (131.0) -
自身を指定された io に繋ぎ換えます。
...に等しくなることに注意してください。
IO#pos, IO#lineno などは指定された io と等しくなります。
@param io 自身を繋ぎ換えたい IO オブジェクトを指定します。
@raise IOError 指定された io が close されている場合に発生します。...