# class Puppet::Parser::AST::Collection

### Attributes

form[RW]
override[R]
query[RW]
type[RW]

### Public Instance Methods

evaluate(scope) click to toggle source

We return an object that does a late-binding evaluation.

    # File lib/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

override=(override) click to toggle source

Handle our parameter ourselves

    # File lib/puppet/parser/ast/collection.rb, line 41
    def override=(override)
      @override = if override.is_a?(AST::ASTArray)
        override
      else
        AST::ASTArray.new(:line => override.line,:file => override.file,:children => [override])
      end
    end