Method: File.readable?

Defined in:
file.c

.readable?(file_name) ⇒ Boolean

Returns true if the named file is readable by the effective user and group id of this process. See eaccess(3).

Note that some OS-level security features may cause this to return true even though the file is not readable by the effective user/group.

Returns:

  • (Boolean)


1794
1795
1796
1797
1798
1799
# File 'file.c', line 1794

static VALUE
rb_file_readable_p(VALUE obj, VALUE fname)
{
    if (rb_eaccess(fname, R_OK) < 0) return Qfalse;
    return Qtrue;
}