Module | FileTest
In: | lib/core/facets/filetest/contains.rb lib/core/facets/filetest/relative.rb lib/core/facets/filetest/root.rb lib/core/facets/filetest/safe.rb lib/core/facets/filetest/separator_pattern.rb

### Methods

absolute? chop_basename contains? relative? root? safe?

### Constants

SEPARATOR_PATTERN | = | ( if File::ALT_SEPARATOR |  |

### Public Instance methods

absolute?(path)

Predicate method for testing whether a path is absolute. It returns `true` if the pathname begins with a slash.

chop_basename(path)

List File.split, but preserves the file separators.

      FileTest.chop_basename('/usr/lib') #=> ['/usr/', 'lib']
      FileTest.chop_basename('/') #=> nil

Returns Array of `[pre-basename, basename]` or `nil`.

This method is here simply to support the relative? and absolute? methods.

contains?(child, parent=Dir.pwd)

Does the `parent` contain the `child`?

relative?(path)

The opposite of absolute?

root?(dir=nil)

Is the specified directory the root directory?

CREDIT: Jeffrey Schwab

safe?(path)

Is a path considered reasonably "safe"?

Do not mistake this for a perfect solution!

[Validate]