種類
- モジュール関数 (382)
- インスタンスメソッド (116)
- 特異メソッド (30)
- クラス (11)
ライブラリ
- ビルトイン (539)
クラス
-
ARGF
. class (11) - Binding (6)
- Exception (29)
- File (11)
- IO (22)
- Method (10)
- Module (5)
-
ObjectSpace
:: WeakMap (11) - String (8)
- Thread (22)
キーワード
- Proc (11)
- []= (11)
-
backtrace
_ locations (33) - binmode (11)
- blockdev? (11)
-
caller
_ locations (22) - chardev? (11)
- closed? (11)
-
const
_ source _ location (5) - directory? (11)
- empty? (8)
- executable? (11)
-
executable
_ real? (11) - exist? (11)
- exists? (9)
- file? (11)
- grpowned? (11)
- gsub (33)
- identical? (11)
- inspect (5)
- lambda (17)
-
latest
_ gc _ info (11) - new (8)
- open (11)
- owned? (11)
- pipe? (11)
- proc (18)
- puts (11)
- readable? (11)
-
readable
_ real? (11) -
set
_ backtrace (11) - setgid? (11)
- setuid? (11)
- socket? (11)
-
source
_ location (6) - sticky? (11)
- symlink? (11)
-
to
_ s (5) -
world
_ readable? (11) -
world
_ writable? (11) - writable? (11)
-
writable
_ real? (11) - zero? (11)
検索結果
先頭5件
-
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (26235.0) -
単体のファイルでファイルテストを行います。
...はシンボリックリンクである
: ?p
ファイルは名前つきパイプ(FIFO)である
: ?S
ファイルはソケットである
: ?b
ファイルはブロックスペシャルファイルである
: ?c
ファイルはキャラクタースペシャルファイルである
:......me
: ?A
ファイルの最終アクセス時刻を返す -> Time
: ?C
ファイルの inode 変更時刻を返す -> Time
//emlist[例][ruby]{
IO.write("testfile", "test")
test("r", "testfile") # => true
test("s", "testfile") # => 4
test("M", "testfile") # => 2018-03-31 07:38:40 +0900
//}... -
Kernel
. # test(cmd , file1 , file2) -> bool (26225.0) -
2ファイル間のファイルテストを行います。
...-
ファイル1とファイル2が同一のファイルである
//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}
# => =: true
# => <: false
# => >: false
# =... -
FileTest
. # writable?(file) -> bool (17106.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
. # blockdev?(file) -> bool (17100.0) -
ファイルがブロックスペシャルファイルである時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /dev/disk0
# /dev/disk0s3
# ...... -
FileTest
. # executable?(file) -> bool (17100.0) -
ファイルがカレントプロセスにより実行できる時に真を返しま す。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
@param file ファイル名を表す文字列を指定します。
例:
FileTest.executable?('/bin') # => true
FileTest.executable?('/bin/bash') # => true... -
FileTest
. # executable _ real?(file) -> bool (17100.0) -
ファイルがカレントプロセスの実ユーザか実グループで実行できる時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには 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") # => false
//}... -
FileTest
. # readable?(file) -> bool (17100.0) -
ファイルがカレントプロセスにより読み込み可能な時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...は false を返します。
@param file ファイル名を表す文字列を指定します。
//emlist[例][ruby]{
IO.write("testfile", "")
File.chmod(0644, "testfile")
FileTest.readable?("testfile") # => true
File.chmod(0200, "testfile")
FileTest.readable?("testfile") # => false
//}... -
FileTest
. # readable _ real?(file) -> bool (17100.0) -
ファイルがカレントプロセスの実ユーザか実グループによって読み込み可能な時に真を 返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...読み込み可能な時に真を
返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
@param file ファイル名を表す文字列を指定します。
@see FileTest.#readable?... -
FileTest
. # world _ readable?(path) -> Integer | nil (17100.0) -
path が全てのユーザから読めるならばそのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
...整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
@param path パスを表す文字列を指定します。
m = FileTest.world_readable?("/etc/passwd")
"%o" % m # => "644"... -
FileTest
. # world _ writable?(path) -> bool (17100.0) -
path が全てのユーザから書き込めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
...を表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
@param path パスを表す文字列を指定します。
m = FileTest.world_writable?("/tmp")
"%o" % m #=> "777"...