Method: File.umask
- Defined in:
- file.c
.umask ⇒ Integer .umask(integer) ⇒ Integer
Returns the current umask value for this process. If the optional argument is given, set the umask to that value and return the previous value. Umask values are subtracted from the default permissions, so a umask of 0222
would make a file read-only for everyone.
File.umask(0006) #=> 18
File.umask #=> 6
3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 |
# File 'file.c', line 3220
static VALUE
rb_file_s_umask(int argc, VALUE *argv, VALUE _)
{
mode_t omask = 0;
switch (argc) {
case 0:
omask = umask(0);
umask(omask);
break;
case 1:
omask = umask(NUM2MODET(argv[0]));
break;
default:
rb_error_arity(argc, 0, 1);
}
return MODET2NUM(omask);
}
|