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#sticky?

() -> untyped
sticky? → true or false

Returns whether the sticky bit is set in the special bits for the entry at the path in self:

Example
pn = Pathname('/tmp/t.tmp')
pn.write('foo')
pn.stat.mode.to_s(8) # => "100664"
pn.sticky?           # => false
pn.chmod(01644)      # Set sticky bit.
pn.stat.mode.to_s(8) #  => "101644"
pn.sticky?           # => true
pn.delete # => 1     # Clean up.

Returns false on Windows.

See also #stat #sub #split_names #sub_ext also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0