cfndsl 0.0.7 → 0.0.8
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.
- data/lib/cfndsl/JSONable.rb +9 -3
- metadata +1 -1
data/lib/cfndsl/JSONable.rb
CHANGED
@@ -59,15 +59,21 @@ module CfnDsl
|
|
59
59
|
#
|
60
60
|
# The actual Fn::Join call corresponding to the above FnFormat call would be
|
61
61
|
# {"Fn::Join": ["",["This is a ","test",". It is 100","%"," ","effective"]]}
|
62
|
+
#
|
63
|
+
# If no arguments are given, or if a hash is given and the format
|
64
|
+
# variable name does not exist in the hash, it is used as a Ref
|
65
|
+
# to an existing resource or parameter.
|
66
|
+
#
|
62
67
|
array = [];
|
63
|
-
if(arguments.length ==
|
64
|
-
|
68
|
+
if(arguments.length == 0 ||
|
69
|
+
(arguments.length == 1 && arguments[0].instance_of?(Hash)) ) then
|
70
|
+
hash = arguments[0] || {}
|
65
71
|
string.scan( /(.*?)(%(%|\{(\w+)\})|\z)/m ) do |x,y|
|
66
72
|
array.push $1 if $1 && $1 != ""
|
67
73
|
if( $3 == '%' ) then
|
68
74
|
array.push '%'
|
69
75
|
elsif( $3 ) then
|
70
|
-
array.push hash[ $4 ]
|
76
|
+
array.push hash[ $4 ] || Ref( $4 )
|
71
77
|
end
|
72
78
|
end
|
73
79
|
else
|