Class: WAG::WASM

Inherits:
Object
  • Object
show all
Defined in:
lib/wag/wasm.rb

Overview

A container for the WebAssembly binary format.

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ WASM

Returns a new instance of WASM.



6
7
8
# File 'lib/wag/wasm.rb', line 6

def initialize(code)
  @code = code
end

Instance Method Details

#save(path) ⇒ Object



14
15
16
# File 'lib/wag/wasm.rb', line 14

def save(path)
  File.write(path, @code)
end

#to_sObject



18
19
20
# File 'lib/wag/wasm.rb', line 18

def to_s
  @code
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/wag/wasm.rb', line 10

def valid?
  WAG::WABT.new.wasm_validate(@code)
end