Method: PDK::Generate::PuppetObject#module_name

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

#module_nameString

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.

Retrieves the name of the module (without the forge username) from the module metadata.

Returns:

  • (String)

    The name of the module.



215
216
217
218
219
220
221
222
# File 'lib/pdk/generate/puppet_object.rb', line 215

def module_name
  return nil unless context.is_a?(PDK::Context::Module)

  require 'pdk/util'
  @module_name ||= PDK::Util.(context.root_path)['name'].rpartition('-').last
rescue ArgumentError => e
  raise PDK::CLI::FatalError, e
end