Method: File::Stat#world_writable?

Defined in:
file.c

#world_writable?Integer?

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).

m = File.stat("/tmp").world_writable?	    #=> 511
sprintf("%o", m)				    #=> "777"

Returns:



6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
# File 'file.c', line 6088

static VALUE
rb_stat_ww(VALUE obj)
{
#ifdef S_IWOTH
    struct stat *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;
}