Module: Extism::HostEnvironment
- Defined in:
- lib/extism/host_environment.rb
Overview
Represents an “environment” that can be imported to a plug-in
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#host_functions ⇒ Array<Extism::Function>
Creates the host functions to pass to the plug-in on intialization.
Class Method Details
.included(base) ⇒ Object
19 20 21 22 |
# File 'lib/extism/host_environment.rb', line 19 def self.included(base) base.extend ClassMethods base.class_variable_set(:@@import_funcs, []) end |
Instance Method Details
#host_functions ⇒ Array<Extism::Function>
Creates the host functions to pass to the plug-in on intialization. Used internally by the Plugin initializer
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/extism/host_environment.rb', line 30 def host_functions import_funcs = self.class.class_variable_get(:@@import_funcs) import_funcs.map do |f| name, params, returns = f Extism::Function.new( name.to_s, params, returns, method(name).to_proc ) end end |