class CloudFormer::Functions::And

Public Class Methods

new(*conditions) click to toggle source
# File lib/cloud_former/functions/and.rb, line 5
def initialize(*conditions)
  @conditions = conditions
end

Public Instance Methods

dump_json() click to toggle source
# File lib/cloud_former/functions/and.rb, line 9
def dump_json
  mapped = @conditions.map do |cond|
    if cond.is_a?(Condition)
      { 'Condition' => cond.get_name }
    elsif cond.is_a?(Function)
      cond.dump_json
    elsif cond.respond_to?(:get_name)
      { 'Ref' => cond.get_name }
    elsif cond.respond_to?(:to_s)
      cond.to_s
    end
  end

  { 'Fn::And' => mapped }
end