Sha256: 70329951dacd4544ac7a8b3825c5269cfa7ccfa4f93aba617915c82f7963de40
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
# Utility methods to make CloudFormation functions feel more like Ruby module Cfer::Core::Functions def join(sep, *args) {"Fn::Join" => [sep, [ *args ].flatten ]} end def ref(r) {"Ref" => r} end def get_att(r, att) {"Fn::GetAtt" => [r, att]} end def find_in_map(map_name, key1, key2) {"Fn::FindInMap" => [map_name, key1, key2]} end def select(i, o) {"Fn::Select" => [i, o]} end def and(*conds) {"Fn::And" => conds} end def or(*conds) {"Fn::Or" => conds} end def equals(a, b) {"Fn::Equals" => [a, b]} end def if(cond, t, f) {"Fn::If" => [cond, t, f]} end def not(cond) {"Fn::Not" => [cond]} end def get_azs(region) {"Fn::GetAZs" => region} end def sub(str, vals = {}) {"Fn::Sub" => [str, vals]} end def notification_arns ref 'AWS::NotificationARNs' end end module Cfer::Core::Functions::AWS extend Cfer::Core::Functions def self.method_missing(sym, *args) method = sym.to_s.camelize raise "AWS::#{method} does not accept arguments" unless args.empty? ref "AWS::#{method}" end end module Cfer::Core::Functions::Fn extend Cfer::Core::Functions def self.method_missing(sym, *args) method = sym.to_s.camelize raise "Fn::#{method} requires one argument" unless args.size == 1 { "Fn::#{method}" => args.first } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
cfer-0.6.2 | lib/cfer/core/functions.rb |
cfer-0.6.1 | lib/cfer/core/functions.rb |
cfer-0.6.0 | lib/cfer/core/functions.rb |
cfer-0.5.0 | lib/cfer/core/functions.rb |