# File lib/puppet/parser/collector.rb, line 10
10:     def evaluate
11:         # Shortcut if we're not using storeconfigs and they're trying to collect
12:         # exported resources.
13:         if form == :exported and Puppet[:storeconfigs] != true
14:             Puppet.warning "Not collecting exported resources without storeconfigs"
15:             return false
16:         end
17: 
18:         if self.resources
19:             unless objects = collect_resources and ! objects.empty?
20:                 return false
21:             end
22:         else
23:             method = "collect_#{@form.to_s}"
24:             objects = send(method).each do |obj|
25:                 obj.virtual = false
26:             end
27:             if objects.empty?
28:                 return false
29:             end
30:         end
31: 
32:         # we have an override for the collected resources
33:         if @overrides and !objects.empty?
34: 
35:             # force the resource to be always child of any other resource
36:             overrides[:source].meta_def(:child_of?) do
37:                 true
38:             end
39: 
40:             # tell the compiler we have some override for him unless we already
41:             # overrided those resources
42:             objects.each do |res|
43:                 unless @collected.include?(res.ref)
44:                     res = Puppet::Parser::Resource.new(
45:                         :type => res.type,
46:                         :title => res.title,
47:                         :params => overrides[:params],
48:                         :file => overrides[:file],
49:                         :line => overrides[:line],
50:                         :source => overrides[:source],
51:                         :scope => overrides[:scope]
52:                     )
53: 
54:                     scope.compiler.add_override(res)
55:                 end
56:             end
57:         end
58: 
59:         # filter out object that already have been collected by ourself
60:         objects.reject! { |o| @collected.include?(o.ref) }
61: 
62:         return false if objects.empty?
63: 
64:         # keep an eye on the resources we have collected
65:         objects.inject(@collected) { |c,o| c[o.ref]=o; c }
66: 
67:         # return our newly collected resources
68:         objects
69:     end