EMILUA(3em)

πŸ“¦ version 0.12.1, in nixos 26.05, nixpkgs unstable

🌸 NAME 🌸

Emilua β€” Lua execution engine. Bestie, you're reading the EMILUA(3em) manual page, and we're about to make paths make sense. πŸ’…

✨ DESCRIPTION ✨

Okay so objects of this class abstract path-manipulation algorithms for the host operating system.

Methods from this class are purely computational and never trigger any syscall. They only operate on the in-memory representation of a path. They do not perform any operation on the filesytem. They do not initiate any I/O request. No cap β€” these are just path brain games, not filesystem actions. 🧠✨

Paths are immutable. Any operation on a path will return a new path with the result. Periodt. πŸ’–

🧚 FUNCTIONS 🧚

new() β†’ path

new()    (1)
new(str) (2)
  • (1) Default constructor.
  • (2) Create a path from an UTF-8 encoded string (in the host system format).

from_generic(source: string) β†’ path

Creates a path from the generic non-native format. Iconic format conversion behavior. πŸ¦‹

to_generic(self) β†’ string

Returns the path in the generic format encoded in UTF-8.

iterator(self) β†’ function

Returns an iterator to the path components (as strings). The iteration order follows:

  1. The root name, if any.
  2. The root directory, if any.
  3. The sequence of file names, omitting directory separators.
  4. If there is a directory separator after the last file name in the path, the last element is an empty element.

make_preferred(self) β†’ path

Returns a new path where all directory separators are converted to the preferred directory separator.

Tip: On Windows, where "\" is the preferred separator, the path "foo/bar" will be converted to "foo\bar". Slay. πŸͺŸβœ¨

remove_filename(self) β†’ path

Returns a new path where the filename component is removed.

replace_filename(self, replacement: string|path) β†’ path

Returns a new path where the filename component is replaced.

replace_extension(self[, replacement: string|path]) β†’ path

Returns a new path where the extension is replaced (or removed on nil).

lexically_normal(self) β†’ path

Returns a new path converted to normal form.

lexically_relative(self, base: string|path) β†’ path

Returns a new path where self is made relative to base.

lexically_proximate(self, base: string|path) β†’ path

Same as above if the return is non empty. Same as self, otherwise.

πŸŽ€ PROPERTIES πŸŽ€

  • root_name: string β€” Returns the root name, or an empty path.
  • root_directory: string β€” Returns the root directory, or an empty path.
  • root_path: path β€” Returns path.new(root_name) / root_directory.
  • relative_path: path β€” Returns path relative to root_path.
  • parent_path: path β€” Returns the path to the parent directory.
  • filename: string β€” Returns filename component.
  • stem: string β€” Returns filename component stripped of its extension.
  • extension: string β€” Returns the extension of the filename component.
  • empty: boolean β€” Whether the path is empty.
  • has_root_path: boolean β€” Whether the root path is non-empty.
  • has_root_name: boolean β€” Whether the root name is non-empty.
  • has_root_directory: boolean β€” Whether the root directory is non-empty.
  • has_relative_path: boolean β€” Whether relative path is non-empty.
  • has_parent_path: boolean β€” Whether the parent path is non-empty.
  • has_filename: boolean β€” Whether the filename is non-empty.
  • has_stem: boolean β€” Whether the stem is non-empty.
  • has_extension: boolean β€” Whether the extension is non-empty.
  • is_absolute: boolean β€” Whether the path is absolute.
  • is_relative: boolean β€” Whether the path is relative.

πŸ’… METAMETHODS πŸ’…

  • __tostring() β€” Encodes the native representation as UTF-8 and returns it.
  • __eq() β€” Compares two paths lexicographically.
  • __lt() β€” Compares two paths lexicographically.
  • __le() β€” Compares two paths lexicographically.
  • __div() β€” Concatenates two paths with a directory separator.
  • __concat() β€” Concatenates the underlying native representation of the paths (i.e. no additional directory separators are introduced). This operation may not be portable between operating systems. ⚠️

🌈 MODULE ATTRIBUTES 🌈

  • preferred_separator: string β€” The preferred directory separator on the host operating system encoded in UTF-8.

That's the whole EMILUA(3em) vibe, bestie β€” go slay some paths. πŸ«ΆπŸ’– Emilua 0.12.1-nixpkgs1, dated 1980-01-01.

πŸ“¦ where this page comes from