Sha256: 3d90df4c1c3d48bdeddf1b085dc5d0b8aabd5fd1842c273c27e1251b04f18518

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

class Directory {
  def self create: dirname {
    """
    @dirname Path of @Directory@ to create.

    Creates a new @Directory@ on the filesystem, possibly throwing
    IOError Exceptions that might occur.
    """

    try {
      Dir mkdir(dirname)
    } catch Errno::EEXIST => e {
      IOError new: (e message) . raise!
    }
  }

  def self create!: dirname {
    """
    @dirname Path of @Directory@ to create.

    Creates a new @Directory@ on the filesystem, ignoring any
    Exceptions that might occur.
    Basically works like running `mkdir -p` on the shell.
    """

    try {
      create: dirname
    } catch IOError {
    }
  }


  def self delete: dirname {
    """
    @dirname Path to @Directory@ to delete.

    Deletes a directory with a given name, if it's empty.
    """

    try {
      Dir delete(dirname)
    } catch Exception => e {
      IOError new: (e message) . raise!
    }
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fancy-0.3.3 lib/rbx/directory.fy
fancy-0.3.2 lib/rbx/directory.fy
fancy-0.3.1 lib/rbx/directory.fy
fancy-0.3.0 lib/rbx/directory.fy