text-interpolator 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES +4 -0
- data/lib/text_interpolator/text_interpolator.rb +10 -3
- data/lib/text_interpolator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MjdmMGU5OTNkMDYwZGFkN2JkYzdhNWVkZDY2MjIyZTRlYmMyNDAzMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTViZDRiMTQ0NzkxMDhkM2Y5ZGIwNWM3YjM5ODM3NTZlNzY3ZDIxNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDRhZTVmYzNkYWY2OGQzNTg4ZTgzYjNmOWQwZmEyMWRkZWNjYzc2NmRhMDlm
|
10
|
+
YjAwYzYyYmRjY2EyMDQwNDE5M2YxMjFhYTIxNDkxYzE4ZjYyOTgzNDY2ZjBi
|
11
|
+
MDk4ZWE4NDMyZGJkNmY0Y2QwYzNjNmM2M2ZjZmExNjM3ZDg1MmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWQ5NDM2M2UxZTcyMmQ5YjcxMDdiZTZkOGUwNjY4NTRjMDYzODE5ZjJiNWI0
|
14
|
+
Njg2N2JlNDBkMTEzZjg4MzZiNGE4NTE3MjBmNTM1ZDZmZGI4MTkxNTU5MmZk
|
15
|
+
ZGExOTg3MDEwMWIyMGFmMWNkYjUyOTEyMWIxMjkzZDU5NGQ3MzU=
|
data/CHANGES
CHANGED
@@ -2,7 +2,13 @@ require 'stringio'
|
|
2
2
|
|
3
3
|
class TextInterpolator
|
4
4
|
|
5
|
-
|
5
|
+
def errors
|
6
|
+
@errors ||= []
|
7
|
+
end
|
8
|
+
|
9
|
+
def clear_errors
|
10
|
+
errors.clear
|
11
|
+
end
|
6
12
|
|
7
13
|
def interpolate object, env={}
|
8
14
|
if object.kind_of? String
|
@@ -17,13 +23,14 @@ class TextInterpolator
|
|
17
23
|
end
|
18
24
|
|
19
25
|
def interpolate_string string, env={}
|
20
|
-
|
26
|
+
clear_errors
|
21
27
|
|
22
28
|
value = interpolate_system_variable string
|
23
29
|
|
24
30
|
begin
|
25
31
|
new_value = interpolate_variable value, env
|
26
32
|
rescue KeyError => e
|
33
|
+
new_value = string
|
27
34
|
errors << e.message
|
28
35
|
end
|
29
36
|
|
@@ -31,7 +38,7 @@ class TextInterpolator
|
|
31
38
|
end
|
32
39
|
|
33
40
|
def interpolate_hash hash
|
34
|
-
|
41
|
+
clear_errors
|
35
42
|
|
36
43
|
content = interpolate_system_variables(hash)
|
37
44
|
|