Class: Puppet::Parser::AST::Collection
- Inherits:
-
Branch
- Object
- Puppet::Parser::AST
- Branch
- Puppet::Parser::AST::Collection
- Defined in:
- lib/vendor/puppet/parser/ast/collection.rb
Constant Summary
Constants inherited from Puppet::Parser::AST
Constants included from Util::Docs
Instance Attribute Summary collapse
-
#form ⇒ Object
Returns the value of attribute form.
-
#override ⇒ Object
Returns the value of attribute override.
-
#query ⇒ Object
Returns the value of attribute query.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Branch
Attributes inherited from Puppet::Parser::AST
Attributes included from Util::Docs
Instance Method Summary collapse
-
#evaluate(scope) ⇒ Object
We return an object that does a late-binding evaluation.
Methods inherited from Branch
Methods inherited from Puppet::Parser::AST
associates_doc, #evaluate_match, #initialize, #inspect, #parsefail, #parsewrap, #safeevaluate, settor?, #use_docs
Methods included from Util::Docs
#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub
Methods included from Util::MethodHelper
#requiredopts, #set_options, #symbolize_options
Methods included from Util::Errors
#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail
Constructor Details
This class inherits a constructor from Puppet::Parser::AST::Branch
Instance Attribute Details
#form ⇒ Object
Returns the value of attribute form.
9 10 11 |
# File 'lib/vendor/puppet/parser/ast/collection.rb', line 9 def form @form end |
#override ⇒ Object
Returns the value of attribute override.
10 11 12 |
# File 'lib/vendor/puppet/parser/ast/collection.rb', line 10 def override @override end |
#query ⇒ Object
Returns the value of attribute query.
9 10 11 |
# File 'lib/vendor/puppet/parser/ast/collection.rb', line 9 def query @query end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/vendor/puppet/parser/ast/collection.rb', line 9 def type @type 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 |
# File 'lib/vendor/puppet/parser/ast/collection.rb', line 15 def evaluate(scope) match, code = query && query.safeevaluate(scope) 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 |