class Terrafying::FnRef

Public Class Methods

new( ref:, fn:, args: [] ) click to toggle source
# File lib/terrafying/generator.rb, line 136
def initialize(
  ref:,
  fn:,
  args: []
)
  @ref = ref
  @fn = fn
  @args = args
end

Public Instance Methods

realise() click to toggle source
# File lib/terrafying/generator.rb, line 146
def realise
  ref = @ref.realise
  args = @args.map do |arg|
    if arg == ARG_PLACEHOLDER
      ref
    elsif arg.is_a? String
      "\"#{arg}\""
    else
      arg
    end
  end.join(', ')

  "#{@fn}(#{args})"
end