class
StaticAssets::MemoryStore
- StaticAssets::MemoryStore
- Reference
- Object
Overview
In-memory asset store for single-binary deployments (MemoryStore.from_dir or embed_file).
Included Modules
Defined in:
static_assets/store.crConstructors
-
.from_dir(dir : String) : MemoryStore
Loads an entire directory tree into memory, automatically pairing
.brand.gzsidecars. - .new
Instance Method Summary
-
#add(path : String, data : Bytes | String, content_type : String | Nil = nil, last_modified : Time = Time.utc, brotli : Bytes | String | Nil = nil, gzip : Bytes | String | Nil = nil) : self
Registers an asset in memory with a SHA-256 strong ETag and optional precompressed variants.
- #has_key?(path : String) : Bool
-
#resolve(relative_path : String, accept_encoding : String | Nil, precompressed : Bool = true) : ResolvedAsset | Nil
Resolves
relative_path(slash-delimited, without leading/) and selects the preferred representation according toaccept_encoding. - #size : Int32
Instance methods inherited from module StaticAssets::Store
directory?(relative_path : String) : Bool
directory?,
resolve(relative_path : String, accept_encoding : String | Nil, precompressed : Bool = true) : ResolvedAsset | Nil
resolve
Constructor Detail
def self.from_dir(dir : String) : MemoryStore
#
Loads an entire directory tree into memory, automatically pairing .br and .gz sidecars.
Instance Method Detail
def add(path : String, data : Bytes | String, content_type : String | Nil = nil, last_modified : Time = Time.utc, brotli : Bytes | String | Nil = nil, gzip : Bytes | String | Nil = nil) : self
#
Registers an asset in memory with a SHA-256 strong ETag and optional precompressed variants.
def resolve(relative_path : String, accept_encoding : String | Nil, precompressed : Bool = true) : ResolvedAsset | Nil
#
Description copied from module StaticAssets::Store
Resolves relative_path (slash-delimited, without leading /) and selects the
preferred representation according to accept_encoding.