Class: ExecJS::FastNode::ExternalPipedRuntime::VM

Inherits:
Object
  • Object
show all
Defined in:
lib/execjs/fastnode/external_piped_runtime.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ VM

Returns a new instance of VM.



55
56
57
58
59
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 55

def initialize(options)
  @mutex = Mutex.new
  @socket_path = nil
  @options = options
end

Class Method Details

.finalize(socket_path) ⇒ Object



65
66
67
68
69
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 65

def self.finalize(socket_path)
  proc {
    VMCommand.new(socket_path, "exit", [0]).execute
  }
end

Instance Method Details

#delete_context(context) ⇒ Object



75
76
77
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 75

def delete_context(context)
  command("deleteContext", context)
end

#exec(context, source) ⇒ Object



71
72
73
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 71

def exec(context, source)
  command("exec", {context: context, source: source})
end

#startObject



79
80
81
82
83
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 79

def start
  @mutex.synchronize do
    start_without_synchronization
  end
end

#started?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/execjs/fastnode/external_piped_runtime.rb', line 61

def started?
  !!@socket_path
end