Ruby 2.7.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > FileTestモジュール > executable_real?

module function FileTest.#executable_real?

executable_real?(file) -> bool[permalink][rdoc]

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

[PARAM] file:
ファイル名を表す文字列を指定します。


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