class
Bakelite::Volume
- Bakelite::Volume
- Reference
- Object
Overview
Represents an isolated virtual filesystem volume. Volumes manage their own file registry, mount prefix, priority, and default storage policies.
Defined in:
bakelite/volume.crConstructors
Class Method Summary
-
.normalize_path(path : String | Path) : String
Normalizes directory separators to forward slashes and strips leading/trailing slashes.
Instance Method Summary
-
#[](rel_path : String) : Item
Array access alias for get.
-
#[]?(rel_path : String) : Item | Nil
Nilable array access alias for get?.
-
#add(item : Item) : Item
Registers an item into this volume.
- #default_chunk_size : UInt32
- #default_chunk_size=(default_chunk_size : UInt32)
- #default_compression : CompressionType
- #default_compression=(default_compression : CompressionType)
-
#each_file(&block : Item -> ) : Nil
Iterates over all items in this volume.
-
#empty? : Bool
Checks if this volume has no files.
-
#extract(destination_dir : Path | String, overwrite : Bool = true) : Int32
Extracts all files from this volume into destination_dir on disk.
-
#extract_folder(prefix : String, destination_dir : Path | String, overwrite : Bool = true) : Int32
Extracts a subfolder matching prefix into destination_dir.
-
#files : Array(String)
Returns all relative virtual file paths registered in this volume.
-
#files_with_prefix(prefix : String) : Array(String)
Returns all relative paths starting with the given prefix.
-
#get(rel_path : String) : Item
Fetches an item by relative path inside this volume.
-
#get?(rel_path : String) : Item | Nil
Fetches an item by relative path inside this volume, returning nil if missing.
-
#glob(pattern : String, & : Item -> ) : Nil
Matches files using glob patterns (e.g.
-
#glob(pattern : String) : Array(Item)
Returns an array of items matching the glob pattern.
-
#has_file?(rel_path : String) : Bool
Checks if a relative path exists in this volume.
- #items : Hash(String, Item)
- #mount_point : String
- #mount_point=(new_mount : String)
- #mount_prefix_with_slash : String
- #name : String
- #priority : Int32
- #priority=(priority : Int32)
-
#size : Int32
Total number of files in this volume.
Constructor Detail
Class Method Detail
Normalizes directory separators to forward slashes and strips leading/trailing slashes.
Instance Method Detail
Extracts all files from this volume into destination_dir on disk.
Extracts a subfolder matching prefix into destination_dir.
Returns all relative paths starting with the given prefix.
Fetches an item by relative path inside this volume. Raises KeyError if missing.
Fetches an item by relative path inside this volume, returning nil if missing.
Matches files using glob patterns (e.g. "**/.png", "textures/").