Ruby 2.1.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > File::Statクラス > world_readable?

instance method File::Stat#world_readable?

world_readable? -> Integer | nil[permalink][rdoc]

If stat is readable by others, returns an integer representing the file permission bits of stat. Returns nil otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2).

m = File.stat("/etc/passwd").world_readable?  # => 420
sprintf("%o", m)                              # => "644"