This repository has been archived by the owner on Jun 10, 2018. It is now read-only.
forked from rails/execjs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0be476d
commit 9a5015e
Showing
6 changed files
with
55 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,5 +1,10 @@ | |||
module ExecJS | module ExecJS | ||
module Runtimes | module Runtimes | ||
autoload :Node, "execjs/runtimes/node" | autoload :Node, "execjs/runtimes/node" | ||
autoload :V8, "execjs/runtimes/v8" | |||
|
|||
def self.runtime | |||
V8.new | |||
end | |||
end | end | ||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
(function(program, execJS) { execJS(program) })(function() { #{source} | |||
}, function(program) { | |||
var output; | |||
try { | |||
result = program(); | |||
if (typeof result == 'undefined' && result !== null) { | |||
print('["ok"]'); | |||
} else { | |||
try { | |||
print(JSON.stringify(['ok', result])); | |||
} catch (err) { | |||
print('["err"]'); | |||
} | |||
} | |||
} catch (err) { | |||
print(JSON.stringify(['err', '' + err])); | |||
} | |||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,13 @@ | |||
module ExecJS | |||
module Runtimes | |||
class V8 < Runtime | |||
def command(filename) | |||
"v8 #{filename}" | |||
end | |||
|
|||
def runner_path | |||
File.expand_path('../v8.js', __FILE__) | |||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters