Class: ExecJS::Xtrn::Node

Inherits:
Engine
  • Object
show all
Defined in:
lib/execjs/xtrn/node.rb

Direct Known Subclasses

Nvm

Constant Summary collapse

Run =
{
  args: %w(? .),
  path: 'node',
}
Names =
%w(nodejs node)
Valid =
valid?

Constants inherited from Engine

Engine::Error, Engine::PathX

Class Method Summary collapse

Methods inherited from Engine

#call, compile, #eval, eval, #exec, exec, #load, load, stats, #stats

Class Method Details

.valid?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
# File 'lib/execjs/xtrn/node.rb', line 12

def self.valid?
  i=Names.index do |n|
    Run[:args][0]=n
    {"ok"=>42}==ExecJS::Xtrn::Child.new(Run).say('return 7*6') rescue nil
  end
  Run[:args][0]='!' unless i
  !!i
end