cfndsl 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/cfndsl/JSONable.rb +9 -3
  2. metadata +1 -1
@@ -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 == 1 && arguments[0].instance_of?(Hash) ) then
64
- hash = arguments[0]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfndsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: