Class: CloudFormer::Functions::GetAtt

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

Instance Method Summary collapse

Constructor Details

#initialize(resource, attribute) ⇒ GetAtt

Returns a new instance of GetAtt.



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

def initialize(resource, attribute)
  @resource = resource
  @attribute = attribute
end

Instance Method Details

#acts_as_string?Boolean

Returns:



10
11
12
# File 'lib/cloud_former/functions/get_att.rb', line 10

def acts_as_string?
  true
end

#dump_jsonObject



14
15
16
17
18
19
20
# File 'lib/cloud_former/functions/get_att.rb', line 14

def dump_json
  if @resource.respond_to?(:get_name)
    { 'Fn::GetAtt' => [@resource.get_name, @attribute] }
  elsif @resource.respond_to?(:to_s)
    { 'Fn::GetAtt' => [@resource.to_s, @attribute] }
  end
end