クラス
-
ARGF
. class (22) - Dir (127)
- File (98)
-
File
:: Stat (11) - IO (363)
-
Thread
:: Queue (18) -
Thread
:: SizedQueue (9) - ThreadGroup (22)
キーワード
- atime (11)
- autoclose= (11)
- autoclose? (11)
- birthtime (10)
- children (6)
- chmod (11)
- chown (11)
- clone (11)
-
close
_ on _ exec= (11) -
close
_ on _ exec? (11) -
close
_ read (11) -
close
_ write (11) - closed? (31)
- ctime (11)
- dup (11)
- each (22)
-
each
_ child (12) - enclose (11)
- enclosed? (11)
- eof (11)
- eof? (11)
- fcntl (11)
- fileno (21)
- flock (11)
- fsync (11)
- ioctl (11)
- isatty (11)
- lstat (11)
- mtime (11)
- pid (11)
- pos (22)
- pos= (22)
- read (11)
- readpartial (11)
- reopen (33)
- rewind (22)
- seek (22)
- size (11)
- size? (11)
- stat (11)
- sync (11)
- sync= (11)
- sysseek (11)
- tell (22)
-
to
_ i (11) - tty? (11)
検索結果
先頭5件
-
Thread
:: Queue # close -> self (18160.0) -
キューを close します。close 済みのキューを再度 open することはできません。
...キューを close します。close 済みのキューを再度 open することはできません。
close 後は以下のように動作します。
* Thread::Queue#closed? は true を返します
* Thread::Queue#close は無視されます
* Thread::Queue#enq/push/<< は ClosedQueueError......オブジェクトを返します
また、ClosedQueueError は StopIteration を継承しているため、
close する事でループから脱出する事もできます。
例:
q = Queue.new
Thread.new{
while e = q.deq # wait for nil to break loop
# ...
end
}
q.close... -
Thread
:: SizedQueue # close -> self (18148.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... -
IO
# close -> nil (18140.0) -
入出力ポートをクローズします。
...@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......。
既に close されていた場合には単に無視されます。
@raise Errno::EXXX 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... -
ARGF
. class # close -> self (18122.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?... -
Dir
# close -> nil (18122.0) -
ディレクトリストリームをクローズします。 以降のディレクトリに対する操作は例外 IOError を発生させます。 クローズに成功すれば nil を返します。
...る操作は例外 IOError を発生させます。
クローズに成功すれば nil を返します。
//emlist[例][ruby]{
d = Dir.new(".")
d.close # => nil
//}
@raise IOError close に失敗した場合に発生します。また既に自身が close している場合に発生します。... -
ARGF
. class # close -> self (18116.0) -
現在開いている処理対象のファイルをクローズします。開くファイルが残って いる場合は次のファイルをオープンします。 ただし、標準入力はクローズされません。
...いる場合は次のファイルをオープンします。
ただし、標準入力はクローズされません。
$ 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?... -
Dir
# close -> nil (18110.0) -
ディレクトリストリームをクローズします。 クローズに成功すれば nil を返します。
...ディレクトリストリームをクローズします。
クローズに成功すれば nil を返します。
//emlist[例][ruby]{
d = Dir.new(".")
d.close # => nil
//}... -
IO
# close _ on _ exec? -> bool (6156.0) -
自身に close-on-exec フラグが設定されていた場合 true を返します。 そうでない場合に false を返します。
...自身に close-on-exec フラグが設定されていた場合 true を返します。
そうでない場合に false を返します。
f = open("/dev/null")
f.close_on_exec? #=> true
f.close_on_exec = false
f.close_on_exec? #=> false
f.close_on_exec......= true
f.close_on_exec? #=> true
@see IO#close_on_exec=... -
IO
# close _ read -> nil (6150.0) -
読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。
...読み込み用の 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 (6150.0) -
書き込み用の IO を close します。
...書き込み用の IO を close します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][rub......y]{
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... -
ARGF
. class # closed? -> bool (6149.0) -
現在開いている処理対象のファイルがARGFがcloseされていればtrueを返します。
...理対象のファイルがARGFがcloseされていればtrueを返します。
例:
# $ echo "foo" > foo
# $ echo "bar" > bar
# $ ruby argf.rb foo bar
ARGF.filename # => "foo"
ARGF.close
# 複数のファイルを開いているので1度のARGF.closeではまた全てのファイル......を閉じていないのでfalseになる
ARGF.closed? # => false
ARGF.filename # => "bar"
ARGF.close
# 2つのファイルを開いていたので2度目のARGF.closeで全てのファイルを閉じたためtrueになる
ARGF.closed? # => true
@see IO#closed?, ARGF.class#close... -
IO
# close _ on _ exec=(bool) (6144.0) -
自身に close-on-exec フラグを設定します。
...に close-on-exec フラグを設定します。
このフラグをセットすると exec(2) 時にそのファイルデスクリプタを
close します。
@see fcntl(2)
@param bool 自身の close-on-exec フラグを true か false で指定します。
f = open("/dev/null")
f.close_on......_exec = true
system("cat", "/proc/self/fd/#{f.fileno}") # cat: /proc/self/fd/3: No such file or directory
f.closed? #=> false
@see IO#close_on_exec?...