るりまサーチ

最速Rubyリファレンスマニュアル検索!
44件ヒット [1-44件を表示] (0.044秒)

別のキーワード

  1. _builtin %
  2. bigdecimal %
  3. range %
  4. bn %
  5. integer %

モジュール

キーワード

検索結果

Kernel.#test(cmd, file) -> bool | Time | Integer | nil (18132.0)

単体のファイルでファイルテストを行います。

...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 (18132.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
# => -: fals...

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

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

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

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

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

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

FileTest.#world_writable?(path) -> bool (3008.0)

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

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

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

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

m = FileTest.world_writable?("/tmp")
"%o" % m #=> "777"...