instance method
File::Stat#world_writable?
() -> ::Integer?
stat.world_writable? → integer or nil
file.c
View on GitHub ↗
static VALUE
rb_stat_ww(VALUE obj)
{
#ifdef S_IWOTH
rb_io_stat_data *st = get_stat(obj);
if ((st->ST_(mode) & (S_IWOTH)) == S_IWOTH) {
return UINT2NUM(st->ST_(mode) & (S_IRUGO|S_IWUGO|S_IXUGO));
}
#endif
return Qnil;
}
If stat is writable 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).
Example
m = File.stat("/tmp").world_writable? #=> 511 sprintf("%o", m) #=> "777"