class Puppet::Pops::Evaluator::Collectors::CatalogCollector
Public Class Methods
new(scope, type, query, overrides = nil)
click to toggle source
Creates a CatalogCollector
using the AbstractCollector's constructor to set the scope and overrides
param [Puppet::CompilableResourceType] type the resource type to be collected param [Proc] query the query which defines which resources to match
Calls superclass method
Puppet::Pops::Evaluator::Collectors::AbstractCollector::new
# File lib/puppet/pops/evaluator/collectors/catalog_collector.rb 8 def initialize(scope, type, query, overrides = nil) 9 super(scope, overrides) 10 11 @query = query 12 13 @type = Puppet::Resource.new(type, 'whatever').type 14 end
Public Instance Methods
collect()
click to toggle source
Collects virtual resources based off a collection in a manifest
# File lib/puppet/pops/evaluator/collectors/catalog_collector.rb 17 def collect 18 t = @type 19 q = @query 20 21 scope.compiler.resources.find_all do |resource| 22 resource.type == t && (q ? q.call(resource) : true) 23 end 24 end
to_s()
click to toggle source
# File lib/puppet/pops/evaluator/collectors/catalog_collector.rb 26 def to_s 27 "Catalog-Collector[#{@type}]" 28 end