クラス
-
ARGF
. class (2) - Dir (107)
- File (98)
- IO (253)
キーワード
- atime (11)
- birthtime (10)
- children (6)
- chmod (11)
- chown (11)
- clone (11)
-
close
_ read (11) -
close
_ write (11) - ctime (11)
- dup (11)
- each (22)
-
each
_ child (12) - eof (11)
- eof? (11)
- fcntl (11)
- fileno (21)
- flock (11)
- ioctl (11)
- lstat (11)
- mtime (11)
- pid (11)
- pos (22)
- read (11)
- readpartial (11)
- reopen (33)
- rewind (22)
- seek (22)
- size (11)
- stat (11)
- sync= (11)
- sysseek (11)
- tell (22)
-
to
_ i (11)
検索結果
先頭5件
-
IO
# close -> nil (32258.0) -
入出力ポートをクローズします。
...例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。
@raise Errno::EXXX close に......e 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......うと例外 IOError が発生しま
す。ガーベージコレクトの際にはクローズされていない IO ポートはクロー
ズされます。
self がパイプでプロセスにつながっていれば、そのプロセスの終
了を待ち合わせます。
既に close されて......ise 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... -
Dir
# close -> nil (32244.0) -
ディレクトリストリームをクローズします。 以降のディレクトリに対する操作は例外 IOError を発生させます。 クローズに成功すれば nil を返します。
...リに対する操作は例外 IOError を発生させます。
クローズに成功すれば nil を返します。
//emlist[例][ruby]{
d = Dir.new(".")
d.close # => nil
//}
@raise IOError close に失敗した場合に発生します。また既に自身が close している場合に発生... -
ARGF
. class # close -> self (32234.0) -
現在開いている処理対象のファイルをクローズします。開くファイルが残って いる場合は次のファイルをオープンします。 ただし、標準入力はクローズされません。
...入力はクローズされません。
$ echo "foo" > foo
$ echo "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?... -
IO
# close _ read -> nil (20262.0) -
読み込み用の IO を close します。主にパイプや読み書き両用に作成し た IO オブジェクトで使用します。
... close します。主にパイプや読み書き両用に作成し
た IO オブジェクトで使用します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が読み込み用にオープンされていなければ発生します。
@raise Errno::EXX......X 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 (20262.0) -
書き込み用の IO を close します。
...IO を close します。
既に close されていた場合には単に無視されます。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX close に失敗した場合に発生します。
//emlist[例][ruby]{
f = IO.popen("/b......in/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
# close _ read -> nil (20256.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 _ write -> nil (20256.0) -
書き込み用の 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: no......t opened for writing
end
//}
@see IO#close, IO#closed?, IO#close_read... -
IO
# sysseek(offset , whence = IO :: SEEK _ SET) -> Integer (14221.0) -
lseek(2) と同じです。IO#seek では、 IO#sysread, IO#syswrite と併用すると正しく動作しないので代わりにこのメソッドを使います。 位置 offset への移動が成功すれば移動した位置(ファイル先頭からのオフセット)を返します。
...lseek(2) と同じです。IO#seek では、
IO#sysread, IO#syswrite と併用すると正しく動作しないので代わりにこのメソッドを使います。
位置 offset への移動が成功すれば移動した位置(ファイル先頭からのオフセット)を返します。
書き......出ます。
File.open("/dev/zero") {|f|
buf = f.read(3)
f.sysseek(0)
}
# => -:3:in `sysseek': sysseek for buffered IO (IOError)
File.open("/dev/null", "w") {|f|
f.print "foo"
f.sysseek(0)
}
# => -:3: warning: sysseek for buffered IO
@param offset ファイルポイ......定します。
@param whence 値は以下のいずれかです。
それぞれ代わりに :SET、:CUR、:END、:DATA、:HOLE を指定す
る事も可能です。
* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイル... -
File
# atime -> Time (14215.0) -
最終アクセス時刻を Time オブジェクトとして返します。
...e オブジェクトとして返します。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.atime......} # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime......} # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#ctime, File#mtime, File#birthtime... -
File
# birthtime -> Time (14215.0) -
作成された時刻を Time オブジェクトとして返します。
...時刻を Time オブジェクトとして返します。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
@raise NotImplementedError Windows のような birthtime のない環......境で発生します。
File.new("testfile").birthtime #=> Wed Apr 09 08:53:14 CDT 2003
@see File#lstat, File#atime, File#ctime, File#mtime... -
File
# ctime -> Time (14215.0) -
状態が最後に変更された時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
...時刻を Time オブジェクトとして返します。状態の変更とは chmod などによるものです。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][......ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime......ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.ctime } # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#mtime, File#birthtime... -
File
# mtime -> Time (14215.0) -
最終更新時刻を Time オブジェクトとして返します。
...e オブジェクトとして返します。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.open("testfile") { |f| f.mtime......} # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime......} # => 2017-12-21 22:58:17 +0900
//}
@see File#lstat, File#atime, File#ctime, File#birthtime... -
IO
# seek(offset , whence = IO :: SEEK _ SET) -> 0 (14215.0) -
ファイルポインタを whence の位置から offset だけ移動させます。 offset 位置への移動が成功すれば 0 を返します。
...ファイルポインタを whence の位置から offset だけ移動させます。
offset 位置への移動が成功すれば 0 を返します。
@param offset ファイルポインタを移動させるオフセットを整数で指定します。
@param whence 値は以下のいずれかで......りに :SET、:CUR、:END、:DATA、:HOLE を指定す
る事も可能です。
* IO::SEEK_SET: ファイルの先頭から (デフォルト)
* IO::SEEK_CUR: 現在のファイルポインタから
* IO::SEEK_END: ファイルの末尾から
* IO::SEEK_DATA: offset 以降の......がある位置へ(lseek の man ページ参照。Linux 3.1 以降のみ)
* IO::SEEK_HOLE: offset 以降の次にホールがある位置へ(同上)
@raise Errno::EXXX ファイルポインタの移動に失敗した場合に発生します。
@raise IOError 既に close されていた場合...