Class: WAG::Instruction::Base

Inherits:
Object
  • Object
show all
Includes:
Encodable
Defined in:
lib/wag/instructions/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Encodable

#to_wasm, #to_wat

Class Method Details

.instruction(op_code) ⇒ Object



8
9
10
11
12
# File 'lib/wag/instructions/base.rb', line 8

def self.instruction(op_code)
  klass = Class.new(self)
  klass.define_method(:op_code) { op_code }
  klass
end

Instance Method Details

#nameObject



14
15
16
17
# File 'lib/wag/instructions/base.rb', line 14

def name
  name = WAG::Inflector.inflector.demodulize(self.class.name.to_s)
  WAG::Inflector.inflector.underscore(name).to_sym
end

#to_sexprObject



19
20
21
# File 'lib/wag/instructions/base.rb', line 19

def to_sexpr
  name.to_sym
end