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#gid

() -> ::Integer
gid → integer

On Windows, returns 0.

On other systems, returns the group identifier of the owner of the entry in the snapshot in self:

Example
File.stat('/etc').gid   # => 0
filepath = '/tmp/t.tmp'
File.write(filepath, 'foo')
File.stat(filepath).gid # => 1000
File.delete(filepath)   # Clean up.
See also #ftype #grpowned? #file? #ino also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0