種類
- モジュール関数 (292)
- インスタンスメソッド (36)
- モジュール (11)
- 文書 (11)
ライブラリ
- ビルトイン (303)
- shell (12)
-
shell
/ command-processor (12) -
shell
/ filter (12)
クラス
- Shell (12)
-
Shell
:: CommandProcessor (12) -
Shell
:: Filter (12)
モジュール
- FileTest (292)
キーワード
- [] (18)
- blockdev? (11)
- chardev? (11)
- directory? (11)
- empty? (8)
- executable? (11)
-
executable
_ real? (11) - exist? (11)
- exists? (9)
- file? (11)
- grpowned? (11)
- identical? (11)
- owned? (11)
- pipe? (11)
- readable? (11)
-
readable
_ real? (11) -
ruby 1
. 8 . 4 feature (11) - setgid? (11)
- setuid? (11)
- size (11)
- size? (11)
- socket? (11)
- sticky? (11)
- symlink? (11)
-
world
_ readable? (11) -
world
_ writable? (11) - writable? (11)
-
writable
_ real? (11) - zero? (11)
検索結果
先頭5件
-
FileTest (50012.0)
-
ファイルの検査関数を集めたモジュールです。
...を集めたモジュールです。
=== 注意
FileTest で定義された各メソッドは、システムコールに失敗しても例外を発生させません。
真を返した時のみ、返り値は意味をもちます。
例えば、
File.exist?('/root/.bashrc')
が false を返して... -
FileTest
. # file?(file) -> bool (33256.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 (27318.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
. # size?(file) -> Integer | nil (27149.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
. # directory?(file) -> bool (27143.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 (27143.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
. # empty?(file) -> bool (27138.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 (27138.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 (27137.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 (27137.0) -
ファイルがキャラクタスペシャルファイルの時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.chardev?(file)
}
#...