readable_real?()
public
Returns true if stat is readable by the real user id of
this process.
File.stat("testfile").readable_real?
Show source
/*
* call-seq:
* stat.readable_real? -> true or false
*
* Returns <code>true</code> if <i>stat</i> is readable by the real
* user id of this process.
*
* File.stat("testfile").readable_real? #=> true
*
*/
static VALUE
rb_stat_R(obj)
VALUE obj;
{
struct stat *st = get_stat(obj);
if (getuid() == 0) return Qtrue;
if (rb_stat_rowned(obj))
return st->st_mode & S_IRUSR ? Qtrue : Qfalse;
if (group_member(get_stat(obj)->st_gid))
return st->st_mode & S_IRGRP ? Qtrue : Qfalse;
if (!(st->st_mode & S_IROTH)) return Qfalse;
return Qtrue;
}