execjs 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -9,12 +9,16 @@ module ExecJS
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def eval(source, options = {})
|
12
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
13
|
+
|
12
14
|
if /\S/ =~ source
|
13
15
|
exec("return eval(#{MultiJson.encode("(#{source})")})")
|
14
16
|
end
|
15
17
|
end
|
16
18
|
|
17
19
|
def exec(source, options = {})
|
20
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
21
|
+
|
18
22
|
compile_to_tempfile([@source, source].join("\n")) do |file|
|
19
23
|
extract_result(@runtime.send(:exec_runtime, file.path))
|
20
24
|
end
|
@@ -26,7 +30,7 @@ module ExecJS
|
|
26
30
|
|
27
31
|
protected
|
28
32
|
def compile_to_tempfile(source)
|
29
|
-
tempfile = Tempfile.open([
|
33
|
+
tempfile = Tempfile.open(['execjs', '.js'])
|
30
34
|
tempfile.write compile(source)
|
31
35
|
tempfile.close
|
32
36
|
yield tempfile
|
@@ -7,12 +7,16 @@ module ExecJS
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def exec(source, options = {})
|
10
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
11
|
+
|
10
12
|
if /\S/ =~ source
|
11
13
|
eval "(function(){#{source}})()", options
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def eval(source, options = {})
|
18
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
19
|
+
|
16
20
|
if /\S/ =~ source
|
17
21
|
unbox @v8_context.eval("(#{source})")
|
18
22
|
end
|
@@ -7,12 +7,16 @@ module ExecJS
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def exec(source, options = {})
|
10
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
11
|
+
|
10
12
|
if /\S/ =~ source
|
11
13
|
eval "(function(){#{source}})()", options
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def eval(source, options = {})
|
18
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
19
|
+
|
16
20
|
if /\S/ =~ source
|
17
21
|
unbox @v8_context.eval("(#{source})")
|
18
22
|
end
|
@@ -45,6 +49,10 @@ module ExecJS
|
|
45
49
|
vs[k] = unbox(v) unless v.is_a?(::V8::Function)
|
46
50
|
vs
|
47
51
|
end
|
52
|
+
when String
|
53
|
+
value.respond_to?(:force_encoding) ?
|
54
|
+
value.force_encoding('UTF-8') :
|
55
|
+
value
|
48
56
|
else
|
49
57
|
value
|
50
58
|
end
|
@@ -7,12 +7,16 @@ module ExecJS
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def exec(source, options = {})
|
10
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
11
|
+
|
10
12
|
if /\S/ =~ source
|
11
13
|
eval "(function(){#{source}})()", options
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
17
|
def eval(source, options = {})
|
18
|
+
souce = source.encode('UTF-8') if source.respond_to?(:encode)
|
19
|
+
|
16
20
|
if /\S/ =~ source
|
17
21
|
unbox @rhino_context.eval("(#{source})")
|
18
22
|
end
|
data/lib/execjs/support/json2.js
CHANGED
@@ -159,12 +159,13 @@
|
|
159
159
|
// Create a JSON object only if one does not already exist. We create the
|
160
160
|
// methods in a closure to avoid creating global variables.
|
161
161
|
|
162
|
-
|
163
|
-
if (!JSON) {
|
164
|
-
|
165
|
-
}
|
162
|
+
(function (global) {
|
163
|
+
if (!global.JSON) {
|
164
|
+
global.JSON = {};
|
165
|
+
}
|
166
|
+
|
167
|
+
var JSON = global.JSON;
|
166
168
|
|
167
|
-
(function () {
|
168
169
|
"use strict";
|
169
170
|
|
170
171
|
function f(n) {
|
@@ -477,4 +478,4 @@ if (!JSON) {
|
|
477
478
|
throw new SyntaxError('JSON.parse');
|
478
479
|
};
|
479
480
|
}
|
480
|
-
}());
|
481
|
+
}(this));
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: execjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sam Stephenson
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-05-
|
19
|
+
date: 2011-05-12 00:00:00 -05:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|