jcompiler 0.1.119 → 0.1.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/build +1 -1
  3. data/lib/jcompiler/provider.rb +11 -7
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7bf637b15a11a60b37682468b9c363627100397
4
- data.tar.gz: b89a29ddafaadd32e2d8cc892d145c0365080c30
3
+ metadata.gz: f8a51608fbc917ee8c1ff3a03bd7734d1c2b2a38
4
+ data.tar.gz: c647b9a194c327889205ad7c504ff3b3ddac8e54
5
5
  SHA512:
6
- metadata.gz: d7ea64c75d8dd72968debfc70425de3805e1335e594217e9c59999d708548a2e7407be22f0967c0f4cfcc7b84615dd77328de46de82d0a1b9d9ebbbf4d87bfd7
7
- data.tar.gz: 34ff7fc2463788c8abb5ce6bbfebfcfc9747d2eff3969ec66577a6cd6a240151da60a10131f80d9c33de95d4f94b2f2f13ff9b674831dfad7a8ddfc1b2ebdb28
6
+ metadata.gz: 579bc24feec52227b92e3cf183cf08b4e06e2a9fdb7504e7b0cebe2d365f3937868647e2a629fe5abd86b511df4485eb0081b738f090ec6f883cdcbbe8875854
7
+ data.tar.gz: cecc97a241b4eebc04a926f2cdf2e0c334c4a960ecff6053ffc3eba7f0a8bb71283f748209908925938f6c855ec241d8def66b9d033b3fbee074ac0da1ff9c11
data/build CHANGED
@@ -1 +1 @@
1
- 120
1
+ 121
@@ -3,11 +3,11 @@ class Jcompiler::Provider
3
3
  @context = nil
4
4
  end
5
5
 
6
- def object!(arg_name = nil, &block)
6
+ def object!(arg_src = nil, &block)
7
7
  pre_context = @context
8
8
  @context = []
9
- srcs, subst_src = if arg_name
10
- [block.call(nil), "#{block.parameters[0][1]}=#{arg_name};"]
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!(arg_name, &block)
18
+ def array!(arg_src, &block)
19
19
  item_name = block.parameters[0][1].to_s
20
20
  src = block.call(nil)
21
- %{"[\#{#{arg_name}.map { |#{item_name}| #{src} }.join(',')}]"}
21
+ %{"[\#{(#{arg_src}).map { |#{item_name}| #{src} }.join(',')}]"}
22
22
  end
23
23
 
24
24
  def number!(num)
25
- %{"#{num}"}
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}\\":\#{ActiveSupport::JSON.encode(#{src})}"}
44
+ @context << %{"\\"#{name}\\":\#{(#{src}).to_json}"}
41
45
  end
42
46
 
43
47
  protected
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jcompiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.119
4
+ version: 0.1.120
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsuri Moriya