class Novika::Capabilities::Impl::Disk

Defined in:

novika/capabilities/impl/disk.cr

Instance Method Summary

Instance methods inherited from class Novika::Capabilities::IDisk

can_read?(engine, path : Quote) : Boolean can_read?, copy(engine, src : Quote, dst : Quote) : Bool copy, dir_empty?(engine, path : Quote) : Boolean | Nil dir_empty?, has?(engine, path : Quote) : Boolean has?, has_dir?(engine, path : Quote) : Boolean has_dir?, has_file?(engine, path : Quote) : Boolean has_file?, has_symlink?(engine, path : Quote) : Boolean has_symlink?, home(engine) : Quote home, inject(into target : Block) inject, join(engine, base : Quote, child : Quote) : Quote join, mkdir(engine, path : Quote) mkdir, pwd(engine) : Quote pwd, read?(engine, path : Quote) : Quote | Nil read?, touch(engine, path : Quote) touch, write?(engine, content : Quote, path : Quote) : Bool
write?(engine, content : Byteslice, path : Quote) : Bool
write?

Class methods inherited from class Novika::Capabilities::IDisk

id : String id, on_by_default? : Bool on_by_default?, purpose : String purpose

Instance methods inherited from module Novika::ICapability

capabilities : CapabilityCollection capabilities, inject(into target : Block) inject

Constructor methods inherited from module Novika::ICapability

new(capabilities) new

Instance Method Detail

def can_read?(engine, path : Quote) : Boolean #
Description copied from class Novika::Capabilities::IDisk

Returns whether path exists and is readable.


def copy(engine, src : Quote, dst : Quote) : Bool #
Description copied from class Novika::Capabilities::IDisk

Copies source src (quote path to a file, symlink, or directory) to destination dst (also a quote).

If src is a directory, copies it recursively.

Returns whether the operation was successful.


def dir_empty?(engine, path : Quote) : Boolean | Nil #
Description copied from class Novika::Capabilities::IDisk

Returns whether directory pointed to by path is empty. Returns nil if path does not point to a directory, or if path does not exist.


def has?(engine, path : Quote) : Boolean #
Description copied from class Novika::Capabilities::IDisk

Returns whether path exists.


def has_dir?(engine, path : Quote) : Boolean #
Description copied from class Novika::Capabilities::IDisk

Returns whether path exists and points to a directory.


def has_file?(engine, path : Quote) : Boolean #
Description copied from class Novika::Capabilities::IDisk

Returns whether path exists and points to a file.


def has_symlink?(engine, path : Quote) : Boolean #
Description copied from class Novika::Capabilities::IDisk

Returns whether path exists and points to a symlink.


def home(engine) : Quote #
Description copied from class Novika::Capabilities::IDisk

Returns current user's home directory.


def join(engine, base : Quote, child : Quote) : Quote #
Description copied from class Novika::Capabilities::IDisk

Returns path quote which is the result of joining base path and child path quotes using the platform-specific path separator.


def mkdir(engine, path : Quote) #
Description copied from class Novika::Capabilities::IDisk

Creates an empty directory at path, including any non-existing intermediate directories. Does nothing if path already exists.


def pwd(engine) : Quote #
Description copied from class Novika::Capabilities::IDisk

Returns the working directory.


def read?(engine, path : Quote) : Quote | Nil #
Description copied from class Novika::Capabilities::IDisk

Reads and returns the contents of file at path. Returns nil if there is no file at path.


def touch(engine, path : Quote) #
Description copied from class Novika::Capabilities::IDisk

Creates an empty file at path. Does nothing if path already exists.


def write?(engine, content : Quote, path : Quote) : Bool #
Description copied from class Novika::Capabilities::IDisk

(Over)writes content of file at path with content quote. Returns nil if path doesn't exist or doesn't point to a file.


def write?(engine, content : Byteslice, path : Quote) : Bool #
Description copied from class Novika::Capabilities::IDisk

(Over)writes content of file at path with content byteslice. Returns nil if path doesn't exist or doesn't point to a file.