writable_real?()
public
Returns true if stat is writable by the real user id of this
process.
File.stat("testfile").writable_real?
Show source
static VALUE
rb_stat_W(VALUE obj)
{
struct stat *st = get_stat(obj);
if (getuid() == 0) return Qtrue;
if (rb_stat_rowned(obj))
return st->st_mode & S_IWUSR ? Qtrue : Qfalse;
if (rb_group_member(get_stat(obj)->st_gid))
return st->st_mode & S_IWGRP ? Qtrue : Qfalse;
if (!(st->st_mode & S_IWOTH)) return Qfalse;
return Qtrue;
}