Class: Wardite::HashModule

Inherits:
Object
  • Object
show all
Defined in:
lib/wardite/wasm_module.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hashObject

: 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