Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

File.grpowned?

(::path | ::IO file_name) -> bool
File.grpowned?(object) → 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 given object.

The given object may be the string path or an IO object:

Example
filepath = '/tmp/t.tmp'
File.write(filepath, 'foo')
File.grpowned?(filepath)       # => true
File.grpowned?('/etc')         # => false
File.grpowned?('/etc/passwd')  # => false
File.grpowned?($stdin)         # => false
File.grpowned?('nosuch')       # => false
File.delete(filepath)          # Clean up.
See also .ftype .identical? .fnmatch? .join also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0