Method: PDK::Generate::PuppetObject#initialize

Defined in:
lib/pdk/generate/puppet_object.rb

#initialize(context, object_name, options) ⇒ PuppetObject

Initialises the PDK::Generate::PuppetObject object.

In general, this object should never be instantiated directly. Instead, one of the subclasses should be used e.g. PDK::Generate::Klass.

New subclasses generally only need to inherit this class, set the OBJECT_TYPE constant and implement the #template_data, #target_object_path and #target_spec_path methods.

Parameters:

  • module_dir (String)

    The path to the root of module that the will contain the object.

  • object_name (String)

    The name of the object.

  • options (Hash{Symbol => Object})

Raises:

  • (ArgumentError)


23
24
25
26
27
28
# File 'lib/pdk/generate/puppet_object.rb', line 23

def initialize(context, object_name, options)
  raise ArgumentError, _('Expected PDK::Context::AbstractContext but got \'%{klass}\' for context') % { klass: context.class } unless context.is_a?(PDK::Context::AbstractContext)
  @context = context
  @options = options
  @object_name = object_name
end