APIdock / Ruby
/
Browse About
method

root?

v1_8_6_287 - Show latest stable - Class: Pathname
root?()
public

#root? is a predicate for root directories. I.e. it returns true if the pathname consists of consecutive slashes.

It doesn’t access actual filesystem. So it may return false for some pathnames which points to roots such as /usr/...

# File lib/pathname.rb, line 483
  def root?
    !!(chop_basename(@path) == nil && /#{SEPARATOR_PAT}/o =~ @path)
  end

Related methods

  • Instance methods
  • +
  • <=>
  • ==
  • ===
  • TO_PATH
  • absolute?
  • ascend
  • atime
  • basename
  • blockdev?
  • chardev?
  • chdir
  • children
  • chmod
  • chown
  • chroot
  • cleanpath
  • ctime
  • delete
  • descend
  • dir_foreach
  • directory?
  • dirname
  • each_entry
  • each_filename
  • each_line
  • entries
  • eql?
  • executable?
  • executable_real?
  • exist?
  • expand_path
  • extname
  • file?
  • find
  • fnmatch
  • fnmatch?
  • foreach
  • foreachline
  • freeze
  • ftype
  • grpowned?
  • hash
  • inspect
  • join
  • lchmod
  • lchown
  • link
  • lstat
  • make_link
  • make_symlink
  • mkdir
  • mkpath
  • mountpoint?
  • mtime
  • open
  • opendir
  • owned?
  • parent
  • pipe?
  • read
  • readable?
  • readable_real?
  • readlines
  • readlink
  • realpath
  • relative?
  • relative_path_from
  • rename
  • rmdir
  • rmtree
  • root?
  • setgid?
  • setuid?
  • size
  • size?
  • socket?
  • split
  • stat
  • sticky?
  • sub
  • symlink
  • symlink?
  • sysopen
  • taint
  • to_s
  • truncate
  • unlink
  • untaint
  • utime
  • world_readable?
  • world_writable?
  • writable?
  • writable_real?
  • zero?
  • Class methods
  • getwd
  • glob
  • new
  • Private methods
  • privateadd_trailing_separator
  • privatechop_basename
  • privatecleanpath_aggressive
  • privatecleanpath_conservative
  • privatedel_trailing_separator
  • privatehas_trailing_separator?
  • privateplus
  • privateprepend_prefix
  • privaterealpath_rec
  • privatesplit_names
APIdock API Documentation Browser

© 2026 APIdock