class Terrafying::RootRef

Public Class Methods

new( kind: :resource, type: '', name: ) click to toggle source
# File lib/terrafying/generator.rb, line 73
def initialize(
  kind: :resource,
  type: '',
  name:
)
  @kind = kind
  @type = type
  @name = name
end

Public Instance Methods

fn_call(fn, *args) click to toggle source
Calls superclass method Terrafying::Ref#fn_call
# File lib/terrafying/generator.rb, line 90
def fn_call(fn, *args)
  if @kind == :resource
    self['id'].fn_call(fn, *args)
  else
    super
  end
end
realise() click to toggle source
# File lib/terrafying/generator.rb, line 83
def realise
  type = [@type]
  type = [@kind, @type] if @kind != :resource

  (type + [@name]).reject(&:empty?).join('.')
end
to_s() click to toggle source
Calls superclass method Terrafying::Ref#to_s
# File lib/terrafying/generator.rb, line 98
def to_s
  if @kind == :resource
    "${#{realise}.id}"
  else
    super
  end
end