Class: Kobako::Runtime
- Inherits:
-
Object
- Object
- Kobako::Runtime
- Defined in:
- lib/kobako/runtime.rb,
sig/kobako/runtime.rbs
Overview
Host-side wasmtime runtime, surfaced as a Ruby class by the native ext
(see ext/kobako/src/runtime.rs). The Kobako::Runtime class wraps the
wasmtime engine + compiled module + Store; it is the only Ruby-visible
wasmtime type and the foundational binding layer for Kobako::Sandbox.
This file reopens the magnus-defined class only to add the pure-Ruby
.default_path helper. Every other method (+#from_path+ singleton,
#eval / #run, capture and usage readers) is registered from Rust
at ext load time.
Defined Under Namespace
Classes: GuestYielder, Snapshot
Class Method Summary collapse
-
.default_path ⇒ String
Absolute path to the gem-bundled
data/kobako.wasmartifact. - .from_path ⇒ Object
Instance Method Summary collapse
Class Method Details
.default_path ⇒ String
Absolute path to the gem-bundled data/kobako.wasm artifact. Computed
from this file's location so it works for both bundle exec (running
from the repo) and an installed gem (running from the gem dir).
Returns a String regardless of whether the file currently exists —
call sites that need the file to be present should pass this through
Kobako::Runtime.from_path, which raises
Kobako::ModuleNotBuiltError with a clear remediation message.
Raises Kobako::SetupError if __dir__ is unavailable so that
rescue Kobako::SetupError around Kobako::Sandbox.new catches every
construction-layer failure uniformly, including this path-resolution one.
25 26 27 28 |
# File 'lib/kobako/runtime.rb', line 25 def self.default_path dir = __dir__ or raise Kobako::SetupError, "Kobako::Runtime.default_path requires __dir__" File.("../../data/kobako.wasm", dir) end |
.from_path ⇒ Object
5 |
# File 'sig/kobako/runtime.rbs', line 5
def self.from_path: (
|
Instance Method Details
#eval ⇒ Object
15 |
# File 'sig/kobako/runtime.rbs', line 15
def eval: (
|
#profile ⇒ Symbol
29 |
# File 'sig/kobako/runtime.rbs', line 29
def profile: () -> Symbol
|
#run ⇒ Object
22 |
# File 'sig/kobako/runtime.rbs', line 22
def run: (
|