Sha256: 753a52c5b198a6785a33f14e49edbb6ce0628e293856c28b481c2ec493e7331e

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'puppet/parser/ast/branch'

class Puppet::Parser::AST
    # The AST object for the parameters inside ResourceDefs and Selectors.
    class ResourceParam < AST::Branch
        attr_accessor :value, :param

        def each
            [@param,@value].each { |child| yield child }
        end

        # Return the parameter and the value.
        def evaluate(hash)
            scope = hash[:scope]

            return Puppet::Parser::Resource::Param.new(
                :name => @param,
                :value => @value.safeevaluate(:scope => scope),
                :source => scope.source, :line => self.line, :file => self.file
            )
        end

        def tree(indent = 0)
            return [
                @param.tree(indent + 1),
                ((@@indline * indent) + self.typewrap(self.pin)),
                @value.tree(indent + 1)
            ].join("\n")
        end

        def to_s
            return "%s => %s" % [@param,@value]
        end
    end
end

# $Id: resourceparam.rb 1739 2006-10-06 03:13:15Z luke $

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-0.22.4 lib/puppet/parser/ast/resourceparam.rb
puppet-0.23.0 lib/puppet/parser/ast/resourceparam.rb