jcompiler 0.1.113 → 0.1.114
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 +16 -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: dec545154ef13d050e035f63efb96c2da13eb4e6
|
4
|
+
data.tar.gz: 8bc2db59420fe90452fdcd41f844791ca21e6f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f67e39b6daeb22595645b344b13c73b7d6b8067e0ad41f383e8582bc27e71bc28621a18dc7b25c85734c344c47c2bcc46ff81e712a5d0ed25985a51e3c97e7d7
|
7
|
+
data.tar.gz: 98b161e420fa2f9a7f075b77de2feb396a3b258d27f59879ed21f64b42e5cd2f8101a69ff5b7fb61d5fa9f2081f545670d9bf937492137b7a9abb3e639c7d22b
|
data/build
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
115
|
data/lib/jcompiler/provider.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
class Jcompiler::Provider
|
2
|
-
attr_accessor :context
|
3
|
-
|
4
2
|
def initialize
|
5
3
|
@context = nil
|
6
4
|
end
|
7
5
|
|
8
6
|
def object!(arg_name = nil, &block)
|
9
7
|
pre_context = @context
|
10
|
-
context = []
|
8
|
+
@context = []
|
11
9
|
srcs, subst_src = if arg_name
|
12
10
|
[block.call(nil), "#{block.parameters[0][1]}=#{arg_name};"]
|
13
11
|
else
|
14
12
|
[block.call, '']
|
15
13
|
end
|
16
|
-
context = pre_context
|
14
|
+
@context = pre_context
|
17
15
|
%{"{\#{#{subst_src}[#{srcs.join(',')}].join(',')}}"}
|
18
16
|
end
|
19
17
|
|
@@ -23,11 +21,22 @@ class Jcompiler::Provider
|
|
23
21
|
%{"[\#{#{arg_name}.map { |#{item_name}| #{src} }.join(',')}]"}
|
24
22
|
end
|
25
23
|
|
26
|
-
def
|
27
|
-
%{"#{
|
24
|
+
def number!(num)
|
25
|
+
%{"#{num}"}
|
28
26
|
end
|
29
27
|
|
30
28
|
def method_missing(name, *args, &block)
|
31
|
-
|
29
|
+
src = if block
|
30
|
+
block.call
|
31
|
+
else
|
32
|
+
args[0]
|
33
|
+
end
|
34
|
+
@context << %{"\\"#{name}\\":\#{#{src}}"}
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def value!
|
40
|
+
|
32
41
|
end
|
33
42
|
end
|