216件ヒット
[1-100件を表示]
(0.054秒)
別のキーワード
ライブラリ
- ビルトイン (216)
検索結果
先頭5件
-
IO
# close -> nil (18174.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... -
IO
# close _ write -> nil (12279.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 "nowher......e" # => IOError: 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.po......pen("/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
# close _ read -> nil (6178.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 Err......no::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
# closed? -> bool (6167.0) -
self が完全に(読み込み用と書き込み用の両方が)クローズされている場合に true を返します。 そうでない場合は false を返します。
...例][ruby]{
IO.write("testfile", "test")
f = File.new("testfile")
f.close # => nil
f.closed? # => true
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... -
File
# flock(operation) -> 0 | false (61.0) -
ファイルをロックします。
...になります。
@param operation ロックに対する操作の種類を示す定数を指定します。
どのような定数が利用可能かは以下を参照して下さい。
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX op......Errno::EXXX が発生するかもしれません。
: LOCK_UN
アンロック。
この明示的なアンロック以外に、ファイルのcloseやRubyインタプリタの終了
(プロセスの終了)によっても自動的にロック状態は解除されます。
: LOCK_NB
ノンブロ......いる場合にロックを行う
* 他のプロセスがロックしている状態で排他ロックを行う
//emlist[例1:][ruby]{
# 書き込みロック(write lock)を使用してカウンタを更新。
# ロック前にファイルを切り詰めてしまうので、
# モードに"w"を... -
IO
# reopen(path) -> self (52.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パスを開く際のモードを文字列で指定します。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis......int("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 (52.0) -
path で指定されたファイルにストリームを繋ぎ換えます。
...などはリセットされます。
@param path パスを表す文字列を指定します。
@param mode パスを開く際のモードを文字列で指定します。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "This is line one\nThis......int("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
# fcntl(cmd , arg = 0) -> Integer (43.0) -
IOに対してシステムコール fcntl を実行します。 機能の詳細は fcntl(2) を参照してください。 fcntl(2) が返した整数を返します。
...fcntl(2) を参照してください。
fcntl(2) が返した整数を返します。
@param cmd IO に対するコマンドを、添付ライブラリ fcntl が提供している定数で指定します。
@param arg cmd に対する引数を整数、文字列、booleanのいずれかで指定......0を、true の場合には 1 を渡します。
@raise Errno::EXXX fcntl の実行に失敗した場合に発生します。
@raise IOError 既に close されている場合に発生します。
//emlist[例][ruby]{
require "fcntl"
IO.write("testfile", "abcde")
# ファイル状態フラグ... -
File
# atime -> Time (37.0) -
最終アクセス時刻を Time オブジェクトとして返します。
...
@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...