jcompiler 0.1.119 → 0.1.120
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/build +1 -1
- data/lib/jcompiler/provider.rb +11 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a51608fbc917ee8c1ff3a03bd7734d1c2b2a38
|
4
|
+
data.tar.gz: c647b9a194c327889205ad7c504ff3b3ddac8e54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 579bc24feec52227b92e3cf183cf08b4e06e2a9fdb7504e7b0cebe2d365f3937868647e2a629fe5abd86b511df4485eb0081b738f090ec6f883cdcbbe8875854
|
7
|
+
data.tar.gz: cecc97a241b4eebc04a926f2cdf2e0c334c4a960ecff6053ffc3eba7f0a8bb71283f748209908925938f6c855ec241d8def66b9d033b3fbee074ac0da1ff9c11
|
data/build
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
121
|
data/lib/jcompiler/provider.rb
CHANGED
@@ -3,11 +3,11 @@ class Jcompiler::Provider
|
|
3
3
|
@context = nil
|
4
4
|
end
|
5
5
|
|
6
|
-
def object!(
|
6
|
+
def object!(arg_src = nil, &block)
|
7
7
|
pre_context = @context
|
8
8
|
@context = []
|
9
|
-
srcs, subst_src = if
|
10
|
-
[block.call(nil), "#{block.parameters[0][1]}
|
9
|
+
srcs, subst_src = if arg_src
|
10
|
+
[block.call(nil), "#{block.parameters[0][1]}=(#{arg_src});"]
|
11
11
|
else
|
12
12
|
[block.call, '']
|
13
13
|
end
|
@@ -15,14 +15,18 @@ class Jcompiler::Provider
|
|
15
15
|
%{"{\#{#{subst_src}[#{srcs.join(',')}].join(',')}}"}
|
16
16
|
end
|
17
17
|
|
18
|
-
def array!(
|
18
|
+
def array!(arg_src, &block)
|
19
19
|
item_name = block.parameters[0][1].to_s
|
20
20
|
src = block.call(nil)
|
21
|
-
%{"[\#{#{
|
21
|
+
%{"[\#{(#{arg_src}).map { |#{item_name}| #{src} }.join(',')}]"}
|
22
22
|
end
|
23
23
|
|
24
24
|
def number!(num)
|
25
|
-
%{
|
25
|
+
%{num.to_json}
|
26
|
+
end
|
27
|
+
|
28
|
+
def string!(str)
|
29
|
+
%{str.to_json}
|
26
30
|
end
|
27
31
|
|
28
32
|
def extract!(obj_name, *key_names)
|
@@ -37,7 +41,7 @@ class Jcompiler::Provider
|
|
37
41
|
else
|
38
42
|
args[0]
|
39
43
|
end
|
40
|
-
@context << %{"\\"#{name}\\":\#{
|
44
|
+
@context << %{"\\"#{name}\\":\#{(#{src}).to_json}"}
|
41
45
|
end
|
42
46
|
|
43
47
|
protected
|