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

() -> untyped
symlink? → true or false

Returns whether the entry at the path in self is a symbolic link:

Example
file_pn = Pathname('/etc/passwd')
link_pn = Pathname('/tmp/foo')
link_pn.make_symlink(file_pn)
file_pn.symlink? # => false
link_pn.symlink? # => true
link_pn.delete   # Clean up.
See also #sub_ext #sysopen #sub #to_path also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0