class CfnDsl::PropertyDefinition

extends CfnDsl esource Properties to automatically substitute FnSub recuraively

Public Class Methods

new(value) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 46
def initialize(value)
  @value = fix_substitutions(value)
end

Public Instance Methods

fix_array(val) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 63
def fix_array(val)
  val.map! { |item| fix_substitutions item }
end
fix_hash(val) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 59
def fix_hash(val)
  val.transform_values! { |item| fix_substitutions item }
end
fix_string(val) click to toggle source

TODO Need to add exclusion if string is already a propoerty of FnSub…

# File lib/monkey-patches/cfndsl_patch.rb, line 68
def fix_string(val)
  val.include?('${') ? FnSub(val) : val
end
fix_substitutions(val) click to toggle source
# File lib/monkey-patches/cfndsl_patch.rb, line 50
def fix_substitutions(val)
  return val unless defined? val.class.to_s.downcase

  meth = "fix_#{val.class.to_s.downcase}"
  return send(meth, val) if respond_to?(meth.to_sym)

  val
end