Class: Isomorfeus::Speednode::Runtime

Inherits:
ExecJS::Runtime show all
Defined in:
lib/isomorfeus/speednode/runtime.rb

Defined Under Namespace

Classes: Context, VM, VMCommand

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ExecJS::Runtime

#permissive_compile, #permissive_eval, #permissive_exec

Constructor Details

#initialize(options) ⇒ Runtime

Returns a new instance of Runtime.



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/isomorfeus/speednode/runtime.rb', line 262

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,
    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.



260
261
262
# File 'lib/isomorfeus/speednode/runtime.rb', line 260

def name
  @name
end

#vmObject (readonly)

Returns the value of attribute vm.



260
261
262
# File 'lib/isomorfeus/speednode/runtime.rb', line 260

def vm
  @vm
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


279
280
281
# File 'lib/isomorfeus/speednode/runtime.rb', line 279

def available?
  @binary ? true : false
end

#deprecated?Boolean

Returns:

  • (Boolean)


283
284
285
# File 'lib/isomorfeus/speednode/runtime.rb', line 283

def deprecated?
  @deprecated
end