class

Bakelite::Volume

Inherits Reference < Object

Represents an isolated virtual filesystem volume. Volumes manage their own file registry, mount prefix, priority, and default storage policies.

Constructors

new(name : Symbol | String, mount_point : String = "", priority : Int32 = 0, default_chunk_size : UInt32 = 65536_u32, default_compression : CompressionType = CompressionType::Deflate)
Source

Class methods

normalize_path(path : String | Path) : String

Normalizes directory separators to forward slashes and strips leading/trailing slashes.

Source

Instance methods

[](rel_path : String) : Item

Array access alias for get.

Source
[]?(rel_path : String) : Item | Nil

Nilable array access alias for get?.

Source
add(item : Item) : Item

Registers an item into this volume.

Source
default_chunk_size
Source
default_chunk_size=(default_chunk_size : UInt32)
Source
default_compression
Source
default_compression=(default_compression : CompressionType)
Source
each_file

Iterates over all items in this volume.

Source
empty?

Checks if this volume has no files.

Source
extract(destination_dir : Path | String, overwrite : Bool = true) : Int32

Extracts all files from this volume into destination_dir on disk.

Source
extract_folder(prefix : String, destination_dir : Path | String, overwrite : Bool = true) : Int32

Extracts a subfolder matching prefix into destination_dir.

Source
files

Returns all relative virtual file paths registered in this volume.

Source
files_with_prefix(prefix : String) : Array(String)

Returns all relative paths starting with the given prefix.

Source
get(rel_path : String) : Item

Fetches an item by relative path inside this volume. Raises KeyError if missing.

Source
get?(rel_path : String) : Item | Nil

Fetches an item by relative path inside this volume, returning nil if missing.

Source
glob(pattern : String, & : Item -> ) : Nil

Matches files using glob patterns (e.g. "**/.png", "textures/").

Source
glob(pattern : String) : Array(Item)

Returns an array of items matching the glob pattern.

Source
has_file?(rel_path : String) : Bool

Checks if a relative path exists in this volume.

Source
items
Source
mount_point
Source
mount_point=(new_mount : String)
Source
mount_prefix_with_slash
Source
name
Source
priority
Source
priority=(priority : Int32)
Source
size

Total number of files in this volume.

Source