るりまサーチ

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

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. file open
  4. file atime
  5. file path

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

FileTest.#file?(file) -> bool (12239.0)

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

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

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

例:
FileTest
.file?('/bin/bash') # => true
FileTest
.file?('/bin') # => false
FileTest
.f...
...ile?('/no_such_file') # => false...

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

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

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

ruby 1.8.3 以前ではKernel.#test(?-, file1, file2)を使...
...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 指定された IO オブジェクト file1, file2 が既に close されていた場合に発生します。...

FileTest.#blockdev?(file) -> bool (6132.0)

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

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

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

例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /d...

FileTest.#chardev?(file) -> bool (6132.0)

ファイルがキャラクタスペシャルファイルの時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...

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

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

例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.chardev?(file)
}
#...

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

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

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

@raise IOError 指定された IO オブジェクト 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.#owned?(file) -> bool (6126.0)

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

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

@raise IOError 指定された 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.#size?(file) -> Integer | nil (6126.0)

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

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

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

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

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

FileTest.#writable?(file) -> bool (6126.0)

ファイルがカレントプロセスにより書き込み可能である時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。

...false を返します。

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

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

FileTest.#directory?(file) -> bool (6120.0)

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

...します。

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

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

例:
FileTest
.directory?('/etc') # => true
FileTest
.directory?('/etc/pa...
...sswd') # => false

f = File.open('/etc')
FileTest
.directory?(f) # => true
f.close
FileTest
.directory?(f) # => IOError: closed stream...

FileTest.#executable_real?(file) -> bool (6120.0)

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

...false を返します。

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

//emlist[例][ruby]{
IO.write("empty.txt", "")
File
.chmod(0744, "empty.txt")
FileTest
.executable_real?("empty.txt") # => true
File
.chmod(0644, "empty.txt")
FileTest
.executable_real?("empty.txt")...

絞り込み条件を変える

<< 1 2 3 > >>