Skip to content

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

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.
See also #gid #ino #ftype #inspect also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0