Class: Stackup::YAML::CloudFormationToRuby
- Inherits:
-
Psych::Visitors::ToRuby
- Object
- Psych::Visitors::ToRuby
- Stackup::YAML::CloudFormationToRuby
- Defined in:
- lib/stackup/yaml.rb
Overview
Custom Psych node visitor, with CloudFormation extensions.
Instance Method Summary collapse
Instance Method Details
#accept(target) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/stackup/yaml.rb', line 56 def accept(target) case target.tag when "!Ref" { "Ref" => super } when "!GetAtt" { "Fn::GetAtt" => array_or_dotted_string(super) } when "!GetAZs" { "Fn::GetAZs" => (super || "") } when /^!(\w+)$/ { "Fn::#{Regexp.last_match(1)}" => super } else super end end |
#array_or_dotted_string(arg) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/stackup/yaml.rb', line 71 def array_or_dotted_string(arg) if arg.respond_to?(:split) arg.split(".", 2) else arg end end |