summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/collection.rb
blob: c817b5c5e6df4f1262e480342485313c6e12fa1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require 'puppet'
require 'puppet/parser/ast/branch'
require 'puppet/parser/collector'

# An object that collects stored objects from the central cache and returns
# them to the current host, yo.
class Puppet::Parser::AST
class Collection < AST::Branch
    attr_accessor :type, :query, :form

    # We return an object that does a late-binding evaluation.
    def evaluate(hash)
        scope = hash[:scope]

        if self.query
            str, code = self.query.safeevaluate :scope => scope
        else
            str = code = nil
        end

        newcoll = Puppet::Parser::Collector.new(scope, @type, str, code, self.form)

        scope.newcollection(newcoll)

        newcoll
    end
end
end

# $Id$