Class: Wardite::HashModule
- Inherits:
-
Object
- Object
- Wardite::HashModule
- Defined in:
- lib/wardite/wasm_module.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
: Hash[Symbol, _WasmCallable].
Instance Method Summary collapse
- #callable(fnname) ⇒ Object
-
#initialize(hash) ⇒ HashModule
constructor
A new instance of HashModule.
- #invoke(fnname, store, *args) ⇒ Object
Constructor Details
#initialize(hash) ⇒ HashModule
Returns a new instance of HashModule.
34 35 36 |
# File 'lib/wardite/wasm_module.rb', line 34 def initialize(hash) @hash = hash end |
Instance Attribute Details
#hash ⇒ Object
: Hash[Symbol, _WasmCallable]
31 32 33 |
# File 'lib/wardite/wasm_module.rb', line 31 def hash @hash end |
Instance Method Details
#callable(fnname) ⇒ Object
49 50 51 |
# File 'lib/wardite/wasm_module.rb', line 49 def callable(fnname) self.hash[fnname.to_sym] end |
#invoke(fnname, store, *args) ⇒ Object
42 43 44 45 |
# File 'lib/wardite/wasm_module.rb', line 42 def invoke(fnname, store, *args) fn = self.hash[fnname.to_sym] fn.call(store, args) end |