Class: Puppet::Parser::AST::Collection
- Defined in:
- lib/puppet/parser/ast/collection.rb
Instance Attribute Summary collapse
Attributes inherited from Branch
Instance Method Summary collapse
-
#evaluate(scope) ⇒ Object
We return an object that does a late-binding evaluation.
Methods inherited from Branch
Constructor Details
This class inherits a constructor from Puppet::Parser::AST::Branch
Instance Attribute Details
#override ⇒ Object
10 11 12 |
# File 'lib/puppet/parser/ast/collection.rb', line 10 def override @override end |
Instance Method Details
#evaluate(scope) ⇒ Object
We return an object that does a late-binding evaluation.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/puppet/parser/ast/collection.rb', line 15 def evaluate(scope) match, code = query && query.safeevaluate(scope) if @type == 'class' fail "Classes cannot be collected" end resource_type = scope.find_resource_type(@type) fail "Resource type #{@type} doesn't exist" unless resource_type newcoll = Puppet::Parser::Collector.new(scope, resource_type.name, match, code, self.form) scope.compiler.add_collection(newcoll) # overrides if any # Evaluate all of the specified params. if @override params = @override.collect { |param| param.safeevaluate(scope) } newcoll.add_override( :parameters => params, :file => @file, :line => @line, :source => scope.source, :scope => scope ) end newcoll end |