class Dir

class Dir

lib/dir.tya:2

Dir provides the dir/Dir standard library API.

Source
# Dir provides the dir/Dir standard library API.
class Dir
  # Dir.path stores instance state.
  # @type Nil
  path: nil

  # Dir.list returns entries in path.
  # @param path String path value.
  # @return Any the resulting value.
  static list: path ->
    dir_list(path)

  # Dir.mkdir creates a directory.
  # @param path String path value.
  # @return Any the resulting value.
  static mkdir: path ->
    dir_mkdir(path)

  # Dir.mkdir_all creates a directory and missing parents.
  # @param path String path value.
  # @return Any the resulting value.
  static mkdir_all: path ->
    dir_mkdir_all(path)

  # Dir.remove_all removes a file or directory tree recursively.
  # @param path String path value.
  # @return Any the resulting value.
  static remove_all: path ->
    dir_remove_all(path)

  # Dir.rmdir removes an empty directory.
  # @param path String path value.
  # @return Any the resulting value.
  static rmdir: path ->
    dir_rmdir(path)

  # Dir.temp_dir creates a temporary directory and returns its path.
  # @param prefix Any prefix value.
  # @return Any the resulting value.
  static temp_dir: prefix = "tya" ->
    dir_temp_dir(prefix)

  # Dir.walk visits entries in deterministic order.
  # @param path String path value.
  # @param fn Function fn value.
  # @param options Dict options value.
  # @return Any the resulting value.
  static walk: path, fn, options = {} ->
    dir_walk(path, fn, options)

  # Dir.initialize stores a directory path.
  # @param path String path value.
  # @return Self the initialized object.
  initialize: path = nil ->
    self.path = path

  # Dir.list provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  list: path = nil ->
    if path == nil
      path = self.path
    dir_list(path)

  # Dir.mkdir provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  mkdir: path = nil ->
    if path == nil
      path = self.path
    dir_mkdir(path)

  # mkdir_all creates a directory and missing parents.
  # @param path String path value.
  # @return Any the resulting value.
  mkdir_all: path = nil ->
    if path == nil
      path = self.path
    dir_mkdir_all(path)

  # remove_all removes a file or directory tree recursively.
  # @param path String path value.
  # @return Any the resulting value.
  remove_all: path = nil ->
    if path == nil
      path = self.path
    dir_remove_all(path)

  # Dir.rmdir provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  rmdir: path = nil ->
    if path == nil
      path = self.path
    dir_rmdir(path)

  # temp_dir creates a temporary directory and returns its path.
  # @param prefix Any prefix value.
  # @return Any the resulting value.
  temp_dir: prefix = "tya" ->
    dir_temp_dir(prefix)

  # walk visits entries in deterministic order.
  # @param path String path value.
  # @param fn Function fn value.
  # @param options Dict options value.
  # @return Any the resulting value.
  walk: path, fn = nil, options = {} ->
    if self.path != nil and fn != nil
      options = fn
      fn = path
      path = self.path
    if path == nil
      path = self.path
    dir_walk(path, fn, options)

Instance Variables

path

Dir.path

lib/dir.tya:5

Dir.path stores instance state.

Source
  # Dir.path stores instance state.
  # @type Nil
  path: nil

Static Methods

list

static Dir.list(path)

lib/dir.tya:10

Dir.list returns entries in path.

Source
  # Dir.list returns entries in path.
  # @param path String path value.
  # @return Any the resulting value.
  static list: path ->
    dir_list(path)

mkdir

static Dir.mkdir(path)

lib/dir.tya:16

Dir.mkdir creates a directory.

Source
  # Dir.mkdir creates a directory.
  # @param path String path value.
  # @return Any the resulting value.
  static mkdir: path ->
    dir_mkdir(path)

mkdir_all

static Dir.mkdir_all(path)

lib/dir.tya:22

Dir.mkdir_all creates a directory and missing parents.

Source
  # Dir.mkdir_all creates a directory and missing parents.
  # @param path String path value.
  # @return Any the resulting value.
  static mkdir_all: path ->
    dir_mkdir_all(path)

remove_all

static Dir.remove_all(path)

lib/dir.tya:28

Dir.remove_all removes a file or directory tree recursively.

Source
  # Dir.remove_all removes a file or directory tree recursively.
  # @param path String path value.
  # @return Any the resulting value.
  static remove_all: path ->
    dir_remove_all(path)

rmdir

static Dir.rmdir(path)

lib/dir.tya:34

Dir.rmdir removes an empty directory.

Source
  # Dir.rmdir removes an empty directory.
  # @param path String path value.
  # @return Any the resulting value.
  static rmdir: path ->
    dir_rmdir(path)

temp_dir

static Dir.temp_dir(prefix = "tya")

lib/dir.tya:40

Dir.temp_dir creates a temporary directory and returns its path.

Source
  # Dir.temp_dir creates a temporary directory and returns its path.
  # @param prefix Any prefix value.
  # @return Any the resulting value.
  static temp_dir: prefix = "tya" ->
    dir_temp_dir(prefix)

walk

static Dir.walk(path, fn, options = {})

lib/dir.tya:48

Dir.walk visits entries in deterministic order.

Source
  # Dir.walk visits entries in deterministic order.
  # @param path String path value.
  # @param fn Function fn value.
  # @param options Dict options value.
  # @return Any the resulting value.
  static walk: path, fn, options = {} ->
    dir_walk(path, fn, options)

Methods

initialize

Dir.initialize(path = nil)

lib/dir.tya:54

Dir.initialize stores a directory path.

Source
  # Dir.initialize stores a directory path.
  # @param path String path value.
  # @return Self the initialized object.
  initialize: path = nil ->
    self.path = path

list

Dir.list(path = nil)

lib/dir.tya:60

Dir.list provides the dir/Dir standard library operation.

Source
  # Dir.list provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  list: path = nil ->
    if path == nil
      path = self.path
    dir_list(path)

mkdir

Dir.mkdir(path = nil)

lib/dir.tya:68

Dir.mkdir provides the dir/Dir standard library operation.

Source
  # Dir.mkdir provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  mkdir: path = nil ->
    if path == nil
      path = self.path
    dir_mkdir(path)

mkdir_all

Dir.mkdir_all(path = nil)

lib/dir.tya:76

mkdir_all creates a directory and missing parents.

Source
  # mkdir_all creates a directory and missing parents.
  # @param path String path value.
  # @return Any the resulting value.
  mkdir_all: path = nil ->
    if path == nil
      path = self.path
    dir_mkdir_all(path)

remove_all

Dir.remove_all(path = nil)

lib/dir.tya:84

remove_all removes a file or directory tree recursively.

Source
  # remove_all removes a file or directory tree recursively.
  # @param path String path value.
  # @return Any the resulting value.
  remove_all: path = nil ->
    if path == nil
      path = self.path
    dir_remove_all(path)

rmdir

Dir.rmdir(path = nil)

lib/dir.tya:92

Dir.rmdir provides the dir/Dir standard library operation.

Source
  # Dir.rmdir provides the dir/Dir standard library operation.
  # @param path String path value.
  # @return Any the resulting value.
  rmdir: path = nil ->
    if path == nil
      path = self.path
    dir_rmdir(path)

temp_dir

Dir.temp_dir(prefix = "tya")

lib/dir.tya:100

temp_dir creates a temporary directory and returns its path.

Source
  # temp_dir creates a temporary directory and returns its path.
  # @param prefix Any prefix value.
  # @return Any the resulting value.
  temp_dir: prefix = "tya" ->
    dir_temp_dir(prefix)

walk

Dir.walk(path, fn = nil, options = {})

lib/dir.tya:108

walk visits entries in deterministic order.

Source
  # walk visits entries in deterministic order.
  # @param path String path value.
  # @param fn Function fn value.
  # @param options Dict options value.
  # @return Any the resulting value.
  walk: path, fn = nil, options = {} ->
    if self.path != nil and fn != nil
      options = fn
      fn = path
      path = self.path
    if path == nil
      path = self.path
    dir_walk(path, fn, options)