Class: Puppet::Pops::Loaders::ModuleResolver Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/loaders.rb

Overview

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

Resolves module loaders - resolution of model dependencies is done by Puppet::Module

Instance Method Summary collapse

Constructor Details

#initialize(loaders) ⇒ ModuleResolver

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.

Returns a new instance of ModuleResolver.



503
504
505
506
507
# File 'lib/puppet/pops/loaders.rb', line 503

def initialize(loaders)
  @loaders = loaders
  @index = {}
  @all_module_loaders = nil
end

Instance Method Details

#[](name) ⇒ 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.



509
510
511
# File 'lib/puppet/pops/loaders.rb', line 509

def [](name)
  @index[name]
end

#[]=(name, module_data) ⇒ 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.



513
514
515
# File 'lib/puppet/pops/loaders.rb', line 513

def []=(name, module_data)
  @index[name] = module_data
end

#all_module_loadersObject

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.



517
518
519
# File 'lib/puppet/pops/loaders.rb', line 517

def all_module_loaders
  @all_module_loaders ||= @index.values.map {|md| md.public_loader }
end

#resolve(module_data) ⇒ 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.



521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/puppet/pops/loaders.rb', line 521

def resolve(module_data)
  if module_data.resolved?
    nil
  else
    module_data.private_loader =
      if module_data.restrict_to_dependencies?
        create_loader_with_dependencies_first(module_data)
      else
        create_loader_with_all_modules_visible(module_data)
      end
  end
end