Class: Extism::Manifest
- Inherits:
-
Object
- Object
- Extism::Manifest
- Defined in:
- lib/extism/manifest.rb
Overview
The manifest represents a recipe to build a plug-in. It generally consists of a path to one wasm module but could contain more. It also helps you define some options and restrictions on the runtime behavior of the plug-in. See extism.org/docs/concepts/manifest for more info.
Instance Attribute Summary collapse
-
#manifest_data ⇒ Object
readonly
Returns the value of attribute manifest_data.
Class Method Summary collapse
-
.from_bytes(data, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm module with raw binary data.
-
.from_path(path, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm from file path.
-
.from_url(url, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm from url.
Instance Method Summary collapse
-
#initialize(data) ⇒ Manifest
constructor
Initialize a manifest See extism.org/docs/concepts/manifest for schema.
Constructor Details
#initialize(data) ⇒ Manifest
Initialize a manifest See extism.org/docs/concepts/manifest for schema
64 65 66 |
# File 'lib/extism/manifest.rb', line 64 def initialize(data) @manifest_data = data end |
Instance Attribute Details
#manifest_data ⇒ Object (readonly)
Returns the value of attribute manifest_data.
8 9 10 |
# File 'lib/extism/manifest.rb', line 8 def manifest_data @manifest_data end |
Class Method Details
.from_bytes(data, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm module with raw binary data. Look at #initialize for an interface with more control Consider using a file path instead of the raw wasm binary in memory. The performance is often better letting the runtime load the binary itself.
52 53 54 55 56 57 58 |
# File 'lib/extism/manifest.rb', line 52 def self.from_bytes(data, hash: nil, name: nil) wasm = { data: data } wasm[:hash] = hash unless hash.nil? wasm[:name] = name unless hash.nil? Manifest.new({ wasm: [wasm] }) end |
.from_path(path, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm from file path. Look at #initialize for an interface with more control
34 35 36 37 38 39 40 |
# File 'lib/extism/manifest.rb', line 34 def self.from_path(path, hash: nil, name: nil) wasm = { path: path } wasm[:hash] = hash unless hash.nil? wasm[:name] = name unless hash.nil? Manifest.new({ wasm: [wasm] }) end |
.from_url(url, hash: nil, name: nil) ⇒ Extism::Manifest
Create a manifest of a single wasm from url. Look at #initialize for an interface with more control
18 19 20 21 22 23 24 |
# File 'lib/extism/manifest.rb', line 18 def self.from_url(url, hash: nil, name: nil) wasm = { url: url } wasm[:hash] = hash unless hash.nil? wasm[:name] = name unless hash.nil? Manifest.new({ wasm: [wasm] }) end |