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 9 def initialize(scope, type, query, overrides = nil) 10 super(scope, overrides) 11 12 @query = query 13 14 @type = Puppet::Resource.new(type, 'whatever').type 15 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 18 def collect 19 t = @type 20 q = @query 21 22 scope.compiler.resources.find_all do |resource| 23 resource.type == t && (q ? q.call(resource) : true) 24 end 25 end
to_s()
click to toggle source
# File lib/puppet/pops/evaluator/collectors/catalog_collector.rb 27 def to_s 28 "Catalog-Collector[#{@type}]" 29 end