ライブラリ
- ビルトイン (608)
- pathname (11)
- shell (150)
-
shell
/ command-processor (150) -
shell
/ filter (150) - tempfile (22)
- tmpdir (22)
- zlib (55)
クラス
- Dir (22)
- File (261)
-
File
:: Stat (33) - Pathname (11)
- Shell (150)
-
Shell
:: CommandProcessor (150) -
Shell
:: Filter (150) - Tempfile (22)
-
Zlib
:: GzipWriter (55)
モジュール
- FileTest (292)
キーワード
- Stat (11)
- [] (18)
- blockdev? (40)
- chardev? (40)
- close (11)
- close! (11)
- directory? (51)
- empty? (16)
- executable? (40)
-
executable
_ real? (40) - exist? (40)
- exists? (27)
- file? (51)
- grpowned? (40)
- identical? (22)
- mktmpdir (22)
- new (11)
- open (22)
- owned? (40)
- pipe? (40)
- readable? (40)
-
readable
_ real? (40) -
ruby 1
. 8 . 4 feature (11) - setgid? (40)
- setuid? (40)
- size (40)
- size? (51)
- socket? (40)
- sticky? (40)
- symlink? (51)
- test (18)
-
world
_ readable? (11) -
world
_ writable? (11) - wrap (22)
- writable? (40)
-
writable
_ real? (40) - zero? (40)
- セキュリティモデル (11)
検索結果
先頭5件
-
FileTest (44012.0)
-
ファイルの検査関数を集めたモジュールです。
...を集めたモジュールです。
=== 注意
FileTest で定義された各メソッドは、システムコールに失敗しても例外を発生させません。
真を返した時のみ、返り値は意味をもちます。
例えば、
File.exist?('/root/.bashrc')
が false を返して... -
FileTest
. # file?(file) -> bool (30256.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... -
File
. file?(path) -> bool (27133.0) -
FileTest.#file? と同じです。
...
FileTest.#file? と同じです。
@param path パスを表す文字列か IO オブジェクトを指定します。... -
FileTest
. # identical?(file1 , file2) -> bool (24312.0) -
file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...
file1 と 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
. # directory?(file) -> bool (24143.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
. # exist?(file) -> bool (24143.0) -
ファイルが存在する時に真を返します。そうでない場合、あるいはシステムコールに失敗した場合などには false を返します。
...m file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
FileTest.exist?('/etc/passwd') # => true
FileTest.exist?('/etc') # => true
FileTest.......exist?('/etc/no_such_file') # => false
FileTest.exist?('/etc/no_such_directory') # => false... -
FileTest
. # size?(file) -> Integer | nil (24143.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
. # empty?(file) -> bool (24138.0) -
ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。
...します。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest.zero?("zero.txt")......# => true
IO.write("nonzero.txt", "1")
FileTest.zero?("nonzero.txt") # => false
//}
@see FileTest.#size, FileTest.#size?... -
FileTest
. # zero?(file) -> bool (24138.0) -
ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。
...します。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest.zero?("zero.txt")......# => true
IO.write("nonzero.txt", "1")
FileTest.zero?("nonzero.txt") # => false
//}
@see FileTest.#size, FileTest.#size?... -
FileTest
. # blockdev?(file) -> bool (24137.0) -
ファイルがブロックスペシャルファイルである時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /d...