Class: Puppet::Pops::Binder::Injector::Private::NullInjectorImpl Private

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/pops/binder/injector.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.

This is a mocking “Null” implementation of Injector. It never finds anything

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNullInjectorImpl

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 NullInjectorImpl.



354
355
356
357
358
# File 'lib/puppet/pops/binder/injector.rb', line 354

def initialize
  @entries = []
  @key_factory = Puppet::Pops::Binder::KeyFactory.new()
  @type_calculator = Puppet::Pops::Types::TypeCalculator.singleton
end

Instance Attribute Details

#entriesObject (readonly)

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.



350
351
352
# File 'lib/puppet/pops/binder/injector.rb', line 350

def entries
  @entries
end

#key_factoryObject (readonly)

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.



351
352
353
# File 'lib/puppet/pops/binder/injector.rb', line 351

def key_factory
  @key_factory
end

#type_calculatorObject (readonly)

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.



352
353
354
# File 'lib/puppet/pops/binder/injector.rb', line 352

def type_calculator
  @type_calculator
end

Instance Method Details

#binderObject

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.



378
379
380
# File 'lib/puppet/pops/binder/injector.rb', line 378

def binder
  nil
end

#get_contributionsObject

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.



402
403
404
# File 'lib/puppet/pops/binder/injector.rb', line 402

def get_contributions()
  []
end

#lookup(scope, *args, &block) ⇒ 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.

Raises:

  • (ArgumentError)


360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/puppet/pops/binder/injector.rb', line 360

def lookup(scope, *args, &block)
  raise ArgumentError, "lookup should be called with two or three arguments, got: #{args.size()+1}" unless args.size.between?(1,2)
  # call block with result if given
  if block
    case block.arity
    when 1
      block.call(nil)
    when 2
      block.call(scope, nil)
    else
      raise ArgumentError, "The block should have arity 1 or 2"
    end
  else
    val
  end
end

#lookup_key(scope, key) ⇒ 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.



383
384
385
# File 'lib/puppet/pops/binder/injector.rb', line 383

def lookup_key(scope, key)
  nil
end

#lookup_producer(scope, *args, &block) ⇒ 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.



388
389
390
# File 'lib/puppet/pops/binder/injector.rb', line 388

def lookup_producer(scope, *args, &block)
  lookup(scope, *args, &block)
end

#lookup_producer_key(scope, key) ⇒ 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.



393
394
395
# File 'lib/puppet/pops/binder/injector.rb', line 393

def lookup_producer_key(scope, key)
  nil
end

#lookup_producer_type(scope, type, 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.



398
399
400
# File 'lib/puppet/pops/binder/injector.rb', line 398

def lookup_producer_type(scope, type, name='')
  nil
end