Method: Puppet::Pal::Compiler#create

Defined in:
lib/puppet/pal/compiler.rb

#create(data_type, *arguments) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a new instance of a given data type.



193
194
195
196
197
198
199
200
# File 'lib/puppet/pal/compiler.rb', line 193

def create(data_type, *arguments)
  t = data_type.is_a?(String) ? type(data_type) : data_type
  unless t.is_a?(Puppet::Pops::Types::PAnyType)
    raise ArgumentError, _("Given data_type value is not a data type, got '%{type}'") % { type: t.class }
  end

  call_function('new', t, *arguments)
end