るりまサーチ

最速Rubyリファレンスマニュアル検索!
84件ヒット [1-84件を表示] (0.082秒)
トップページ > クエリ:n[x] > モジュール:FileTest[x]

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. rsa n
  3. rsa n=
  4. openssl n
  5. openssl n=

ライブラリ

キーワード

検索結果

FileTest.#grpowned?(file) -> bool (6101.0)

ファイルのグループ ID がカレントプロセスの実効グループ ID と等しい時に真を返 します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...ト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "")
File.chown(-1, Process.gid, "testfile")
FileTest
.grpowned?("testfile") # => true
File.chown(-1, Process.gid + 10, "testfile")
FileTest
.grpowned?("testfile") # => false
//}...

FileTest.#identical?(file1, file2) -> bool (6101.0)

file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...以前ではKernel.#test(?-, file1, file2)を使ってください。

open("a", "w") {}
p File.identical?("a", "a") #=> true
p File.identical?("a", "./a") #=> true
File.link("a", "b")
p File.identical?("a", "b") #=> true
File.symlink("a", "c")
p File.identical?("a", "c")...
...#=> true
open("d", "w") {}
p File.identical?("a", "d") #=> false

@param file1 ファイル名を表す文字列か IO オブジェクトを指定します。

@param file2 ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された...

FileTest.#owned?(file) -> bool (6101.0)

ファイルのユーザがカレントプロセスの実効ユーザと等しい時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "")
File.chown(Process.uid, -1, "testfile")
FileTest
.owned?("testfile") # => true
File.chown(501, -1, "testfile")
FileTest
.owned?("testfile") # => false
//}...

FileTest.#symlink?(file) -> bool (6101.0)

ファイルがシンボリックリンクである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...た場合などには false を返します。

@param file ファイル名を表す文字列を指定します。

//emlist[例][ruby]{
IO.write("testfile", "test")
FileTest
.symlink?("testfile") # => false
File.symlink("testfile", "testlink")
FileTest
.symlink?("testlink") # => true
//}...

FileTest.#size(file) -> Integer (101.0)

ファイルのサイズを返します。

...e Errno::EXXX file が存在しない場合、あるいはシステムコールに失敗した場合に発生します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

@see FileTest.#size?, FileTest.#zero?

例:
FileTest
.size...

絞り込み条件を変える

FileTest.#size?(file) -> Integer | nil (101.0)

ファイルのサイズを返します。ファイルが存在しない時や ファイルのサイズが0の時には nil を返します。

... nil を返します。

@param file ファイル名を表す文字列か IO オブジェクトを指定します。

@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。

//emlist[例][ruby]{
IO.write("testfile", "test")
FileTest
.si...
...ze?("testfile") # => 4
File.delete("testfile")
FileTest
.size?("testfile") # => nil
//}

@see FileTest.#size, FileTest.#zero?...

FileTest.#world_readable?(path) -> Integer | nil (101.0)

path が全てのユーザから読めるならばそのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。

...ションを表す
整数を返します。そうでない場合は nil を返します。

整数の意味はプラットフォームに依存します。

@param path パスを表す文字列を指定します。

m = FileTest.world_readable?("/etc/passwd")
"%o" % m...