Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
File::Stat#grpowned?
() -> bool
grpowned?(path) → true or false
file.c
View on GitHub ↗
static VALUE
rb_stat_grpowned(VALUE obj)
{
#ifndef _WIN32
if (rb_group_member(get_stat(obj)->ST_(gid))) return Qtrue;
#endif
return Qfalse;
}
Returns false on Windows.
On other systems, returns whether the effective group id of the calling process is the owner of the snapshot in self:
Example
filepath = '/tmp/t.tmp' File.write(filepath, 'foo') File.stat(filepath).grpowned? # => true File.stat('/etc').grpowned? # => false File.stat('/etc/passwd').grpowned? # => false File.delete(filepath) # Clean up.