Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Pathname#setgid?
() -> bool
setgid? → true or false
pathname_builtin.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/pathname_builtin.rb, line 2602
def setgid?() FileTest.setgid?(@path) end
Returns whether the setgid bit is set in the special bits for the entry at the path in self:
Example
pn = Pathname('doc/t.tmp') pn.write('foo') mode = pn.stat.mode.to_s(8) # => "100664" pn.setgid? # => false pn.chmod(0o2644) # Set the bit. mode = pn.stat.mode.to_s(8) # => "102644" pn.setgid? # => true pn.delete # Clean up.
On Windows, the bit is never set; the method always returns false.