lib/humidifier/fn.rb in humidifier-2.15.0 vs lib/humidifier/fn.rb in humidifier-3.0.0
- old
+ new
@@ -1,30 +1,29 @@
# frozen_string_literal: true
module Humidifier
- # Builds CFN function calls
class Fn
# The list of all internal functions provided by AWS from
# http://docs.aws.amazon.com
# /AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html
- FUNCTIONS = Utils.underscored(%w[And Base64 Equals FindInMap GetAtt GetAZs
- If ImportValue Join Not Or Select Sub])
+ FUNCTIONS =
+ Humidifier.underscore(
+ %w[And Base64 Cidr Equals FindInMap GetAtt GetAZs If ImportValue Join
+ Not Or Select Split Sub Transform]
+ )
attr_reader :name, :value
def initialize(name, value)
@name = "Fn::#{name}"
@value = value
end
- # CFN stack syntax
def to_cf
{ name => Serializer.dump(value) }
end
- class << self
- FUNCTIONS.each do |name, func|
- define_method(func) { |value| new(name, value) }
- end
+ FUNCTIONS.each do |name, func|
+ define_singleton_method(func) { |value| new(name, value) }
end
end
end