Class: Quickjs::Runnable

Inherits:
Object
  • Object
show all
Defined in:
lib/quickjs/runnable.rb

Instance Method Summary collapse

Constructor Details

#initialize(bytecode) ⇒ Runnable

Returns a new instance of Runnable.



5
6
7
# File 'lib/quickjs/runnable.rb', line 5

def initialize(bytecode)
  @bytecode = bytecode
end

Instance Method Details

#run(on: nil) ⇒ Object



13
14
15
# File 'lib/quickjs/runnable.rb', line 13

def run(on: nil)
  Quickjs._with_vm(on) {|vm| vm.send(:_run_bytecode, @bytecode) }
end

#to_sObject



9
10
11
# File 'lib/quickjs/runnable.rb', line 9

def to_s
  @bytecode
end