mirror of
https://github.com/extism/extism.git
synced 2026-04-23 03:00:11 -04:00
I noticed when calling set_log_file that it's on the top-level namespace. And so is the rest of the gem. It's not a good idea to do this as it pollutes the user's application. Best practice is to wrap all code in a module which by convention is the gem name. I was also getting `Uninitialized constant FFI:NIL` and in the set_log_file method and I could not tell why it was needed. I changed it to a regular ruby nil. If it's needed for some reason I'll change it back or move to another PR.
11 lines
230 B
Ruby
11 lines
230 B
Ruby
require './lib/extism'
|
|
require 'json'
|
|
|
|
manifest = {
|
|
:wasm => [{:path => "../wasm/code.wasm"}]
|
|
}
|
|
plugin = Extism::Plugin.new(manifest)
|
|
res = JSON.parse(plugin.call("count_vowels", ARGV[0] || "this is a test"))
|
|
puts res['count']
|
|
|