るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.170秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:constants[x] > クエリ:Constants[x] > クエリ:RDWR[x] > クラス:File[x]

別のキーワード

  1. _builtin constants
  2. module constants
  3. constants so_wantmore
  4. context constants
  5. constants ifnamsiz

ライブラリ

キーワード

検索結果

File#flock(operation) -> 0 | false (273.0)

ファイルをロックします。

...クの取得に成功した場合は 0 を返します。
File
::LOCK_NB (ノンブロッキング) を指定すると、本来ならブロックされる場合に
ブロックされずに false を返すようになります。

@param operation ロックに対する操作の種類を示す定数を...
...@raise IOError 自身が close されている場合に発生します。

@raise Errno::EXXX operation に不正な整数を与えた場合などに発生します。

引数 operation に有効な定数は以下の通りです。定数は File::Constants で定義されていますが、
File
...
...クラスの親クラスの IO が File::Constants をインクルードしているので、
これらの定数は File::LOCK_SH などとして参照可能です。

: LOCK_SH
共有ロック。複数のプロセスが同時にロックを共有できます。
システムによってはロッ...

File#path -> String (219.0)

オープン時に使用したパスを文字列で返します。

...
File
::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File
.open("testfile") {|f| f.path } #=> "testfile"
File
.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File
.open("/tmp", File::RDWR...
...| File::TMPFILE){|f| f.path } #=> "/tmp"
//}...
...raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。

//emlist[例][ruby]{
File
.open("testfile") {|f| f.path } #=> "testfile"
File
.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File
...
....open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}...

File#to_path -> String (219.0)

オープン時に使用したパスを文字列で返します。

...
File
::Constants::TMPFILEオプション付きで作成されていたりする場合です。

//emlist[例][ruby]{
File
.open("testfile") {|f| f.path } #=> "testfile"
File
.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File
.open("/tmp", File::RDWR...
...| File::TMPFILE){|f| f.path } #=> "/tmp"
//}...
...raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。

//emlist[例][ruby]{
File
.open("testfile") {|f| f.path } #=> "testfile"
File
.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/../tmp/xxx"
File
...
....open("/tmp", File::RDWR | File::TMPFILE){|f| f.path } # IOError: File is unnamed (TMPFILE?)
//}...