Class | File
In: | lib/yard/core_ext/file.rb
Parent: | Object

### Methods

cleanpath open! read_binary relative_path

### Constants

RELATIVE_PARENTDIR | = | '..'
RELATIVE_SAMEDIR | = | '.'

### Public Class methods

cleanpath(path)

Cleans a path by removing extraneous ’..’, ’.’ and ’/’ characters

@example Clean a path

      File.cleanpath('a/b//./c/../e') # => "a/b/e"

@param [String] path the path to clean @return [String] the sanitized path

open!(file, *args, &block)

Forces opening a file (for writing) by first creating the file‘s directory @param [String] file the filename to open @since 0.5.2

read_binary(file)

Reads a file with binary encoding @return [String] the ascii-8bit encoded data @since 0.5.3

relative_path(from, to)

Turns a path `to` into a relative path from starting point `from`. The argument `from` is assumed to be a filename. To treat it as a directory, make sure it ends in +File::SEPARATOR+ (’/’ on UNIX filesystems).

@param [String] from the starting filename

      (or directory with +from_isdir+ set to +true+).

@param [String] to the final path that should be made relative. @return [String] the relative path from `from` to `to`.

[Validate]