tfdsl 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/tfdsl/formatter.rb +13 -1
- data/lib/tfdsl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cbd396f3294b44d7b23d414852d28ea97c92470b7f8383cfe7d7255328721d4
|
4
|
+
data.tar.gz: a4fd5051c5b6a111f298d83f571b76306bdaff2fd8d819a6dc693c6f55992d7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4f254f3ab80a1366183502a41fb5462b9a6f3d00dcc146c4442ff6a545e375c70b8cd4274d3822050e5dfab5708cf1999e6d41b3dbc32a01d9f556ebfd15ea2
|
7
|
+
data.tar.gz: f0f9b3eb1940f9dd8f90d1166e716f71f539b35c69438393bf36e9c24be7c4cd5d9fd3e9fe0c0ecbf1d784efab617b2b5356a67398211d15dadc511f3b31bfe1
|
data/Gemfile.lock
CHANGED
data/lib/tfdsl/formatter.rb
CHANGED
@@ -39,13 +39,25 @@ module TFDSL
|
|
39
39
|
|
40
40
|
var = tf_block.instance_variable_get var_name
|
41
41
|
var_name = var_name.to_s.delete('@')
|
42
|
+
|
42
43
|
str << Template.list(var_name, var) if var.class == Array
|
43
44
|
str << Template.map(var_name, var) if var.class == Hash
|
44
|
-
|
45
|
+
unless [Array, Hash].include? var.class
|
46
|
+
safe_var = safe_quote safe_multiline var
|
47
|
+
str << Template.value(var_name, safe_var)
|
48
|
+
end
|
45
49
|
end
|
46
50
|
str.join "\n"
|
47
51
|
end
|
48
52
|
|
53
|
+
def safe_multiline(str)
|
54
|
+
str.gsub "\n", '\n'
|
55
|
+
end
|
56
|
+
|
57
|
+
def safe_quote(str)
|
58
|
+
str.gsub(/([^\\])"/, '\1\"')
|
59
|
+
end
|
60
|
+
|
49
61
|
def child_blocks(tf_block)
|
50
62
|
str = []
|
51
63
|
tf_block.__blocks__.each do |b|
|
data/lib/tfdsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tfdsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Lopo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|