class Puppet::Pops::Evaluator::Collectors::CatalogCollector

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, line 17
def collect
  t = @type
  q = @query

  scope.compiler.resources.find_all do |resource|
    resource.type == t && (q ?  q.call(resource) : true)
  end
end

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 [Symbol] type the resource type to be collected param [Proc] query the query which defines which resources to match

# File lib/puppet/pops/evaluator/collectors/catalog_collector.rb, line 8
def initialize(scope, type, query, overrides = nil)
  super(scope, overrides)

  @query = query

  @type = Puppet::Resource.new(type, "whatever").type
end