Skip to content

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

instance method

Pathname#setuid?

() -> bool
setuid? → true or false

Returns whether the setuid 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.setuid?                  # => false
pn.chmod(0o4644)            # Set the bit.
mode = pn.stat.mode.to_s(8) # => "104644"
pn.setuid?                  # => true
pn.delete                   # Clean up.

On Windows, the bit is never set; the method always returns false.

See also #setgid? #size #root? #size? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0