Commit Graph

6 Commits

Author SHA1 Message Date
Benjamin Eckel
23fe3951a3 docs(ruby-sdk): Hygiene: docs, formatter, Makefile (#50)
Work in progress

* Adds some inline docs which generates a yarddoc site
* Adds linting and code formatting abilities using rufo
* Adds a Makefile with common operations

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-10-27 12:20:44 -05:00
Benjamin Eckel
8724de8667 docs(ruby): fix example.rb context usage (#40) 2022-10-24 15:00:26 -04:00
zach
87be73570d Add ExtismContext to SDK + better errors for failed register/update (#19)
- Adds `ExtismContext` instead of global `PLUGINS` registry
- Adds `extism_context_new`, `extism_context_free` and
`extism_context_reset`
- Requires updating nearly every SDK function to add context parameter
- Renames some SDK functions to follow better naming conventions
   - `extism_plugin_register` -> `extism_plugin_new`
   - `extism_output_get` -> `extism_plugin_output_data`
   - `extism_output_length` -> `extism_plugin_output_length`
   - `extism_call` -> `extism_plugin_call`
- Updates `extism_error` to return the context error when -1 issued for
the plug-in ID
- Adds `extism_plugin_free` to remove an existing plugin
- Updates SDKs to include these functions
- Updates SDK examples and comments

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-20 14:53:15 -06:00
zach
4a49408045 fix: handle large allocations (missing commits) (#14) 2022-09-13 00:17:05 -06:00
Benjamin Eckel
ffa01403a3 feat(ruby-sdk): create Extism module / namespace (#5)
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.
2022-09-04 17:05:10 -06:00
Steve Manuel
e27fae9193 v0.0.1 alpha
Co-authored-by: Zach Shipko <zach@dylib.so>
2022-08-25 14:36:47 -06:00