readable?()
public
Returns true if stat is readable by the effective user id of this
process.
File.stat("testfile").readable?
Show source
static VALUE
rb_stat_r(VALUE obj)
{
struct stat *st = get_stat(obj);
if (geteuid() == 0) return Qtrue;
if (rb_stat_owned(obj))
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
if (rb_stat_grpowned(obj))
return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
if (!(st->st_mode & S_IROTH)) return Qfalse;
return Qtrue;
}