Class: Puppet::Pops::Loader::NullLoader

Inherits:
Loader show all
Defined in:
lib/puppet/pops/loader/null_loader.rb

Overview

The null loader is empty and delegates everything to its parent if it has one.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Loader

#[], #load, #private_loader

Constructor Details

#initialize(parent_loader = nil, loader_name = "null-loader") ⇒ NullLoader

Construct a NullLoader, optionally with a parent loader



8
9
10
11
# File 'lib/puppet/pops/loader/null_loader.rb', line 8

def initialize(parent_loader=nil, loader_name = "null-loader")
  @loader_name = loader_name
  @parent = parent_loader
end

Instance Attribute Details

#loader_nameObject (readonly)



4
5
6
# File 'lib/puppet/pops/loader/null_loader.rb', line 4

def loader_name
  @loader_name
end

Instance Method Details

#find(name) ⇒ Object

Finds nothing, there are no entries



32
33
34
# File 'lib/puppet/pops/loader/null_loader.rb', line 32

def find(name)
  nil
end

#get_entry(typed_name) ⇒ Object

Has no entries on its own - always nil



27
28
29
# File 'lib/puppet/pops/loader/null_loader.rb', line 27

def get_entry(typed_name)
  nil
end

#load_typed(typed_name) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/puppet/pops/loader/null_loader.rb', line 18

def load_typed(typed_name)
  if @parent.nil?
    nil
  else
    @parent.load_typed(typed_name)
  end
end

#parentObject

Has parent if one was set when constructed



14
15
16
# File 'lib/puppet/pops/loader/null_loader.rb', line 14

def parent
  @parent
end

#set_entry(typed_name, value, origin = nil) ⇒ Object

Cannot store anything



37
38
39
# File 'lib/puppet/pops/loader/null_loader.rb', line 37

def set_entry(typed_name, value, origin = nil)
  nil
end

#to_sObject



41
42
43
# File 'lib/puppet/pops/loader/null_loader.rb', line 41

def to_s()
  "(NullLoader '#{loader_name}')"
end