Class: Isomorfeus::Speednode::Runtime

Inherits:
ExecJS::Runtime show all
Defined in:
lib/isomorfeus/speednode/runtime.rb,
lib/isomorfeus/speednode/runtime/vm.rb,
lib/isomorfeus/speednode/runtime/context.rb,
lib/isomorfeus/speednode/runtime/vm_command.rb

Defined Under Namespace

Classes: Context, VM, VMCommand

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ExecJS::Runtime

#permissive_compile, #permissive_eval, #permissive_exec

Constructor Details

#initialize(options) ⇒ Runtime



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/isomorfeus/speednode/runtime.rb', line 18

def initialize(options)
  @name        = options[:name]
  @binary      = Isomorfeus::Speednode::NodeCommand.cached(options[:command])
  @runner_path = options[:runner_path]
  @encoding    = options[:encoding]
  @deprecated  = !!options[:deprecated]

  @vm = VM.new(binary: @binary, source_maps: '--enable-source-maps', runner_path: @runner_path)

  @popen_options = {}
  @popen_options[:external_encoding] = @encoding if @encoding
  @popen_options[:internal_encoding] = ::Encoding.default_internal || 'UTF-8'
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/isomorfeus/speednode/runtime.rb', line 16

def name
  @name
end

#vmObject (readonly)

Returns the value of attribute vm.



16
17
18
# File 'lib/isomorfeus/speednode/runtime.rb', line 16

def vm
  @vm
end

Class Method Details

.attach_proc(context_id, func, run_block) ⇒ Object



4
5
6
# File 'lib/isomorfeus/speednode/runtime.rb', line 4

def self.attach_proc(context_id, func, run_block)
  attached_procs[context_id] = { func => run_block }
end

.attached_procsObject



8
9
10
# File 'lib/isomorfeus/speednode/runtime.rb', line 8

def self.attached_procs
  @attached_procs ||= {}
end

.respondersObject



12
13
14
# File 'lib/isomorfeus/speednode/runtime.rb', line 12

def self.responders
  @responders ||= {}
end

Instance Method Details

#available?Boolean



32
33
34
# File 'lib/isomorfeus/speednode/runtime.rb', line 32

def available?
  @binary ? true : false
end

#deprecated?Boolean



36
37
38
# File 'lib/isomorfeus/speednode/runtime.rb', line 36

def deprecated?
  @deprecated
end