Class: CloudFormer::Functions::Equals

Inherits:
CloudFormer::Function show all
Defined in:
lib/cloud_former/functions/equals.rb

Instance Method Summary collapse

Constructor Details

#initialize(value1, value2) ⇒ Equals

Returns a new instance of Equals.



5
6
7
8
# File 'lib/cloud_former/functions/equals.rb', line 5

def initialize(value1, value2)
  @value1 = value1
  @value2 = value2
end

Instance Method Details

#dump_jsonObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cloud_former/functions/equals.rb', line 10

def dump_json
  if @value1.respond_to?(:get_name)
    val1 = { 'Ref' => @value1.get_name }
  elsif @value1.respond_to?(:to_s)
    val1 = @value1.to_s
  end

  if @value2.respond_to?(:get_name)
    val2 = { 'Ref' => @value2.get_name }
  elsif @value2.respond_to?(:to_s)
    val2 = @value2.to_s
  end

  { 'Fn::Equals' => [val1, val2] }
end