Sha256: ad79e4b4d52b8a069c95def239e6462fa89479b7d9d410fabf912f87da9133a2

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 Bytes

Contents

require 'puppet/parser/ast/branch'

class Puppet::Parser::AST
    # Define a variable.  Stores the value in the current scope.
    class VarDef < AST::Branch
        attr_accessor :name, :value

        @settor = true

        # Look up our name and value, and store them appropriately.  The
        # lexer strips off the syntax stuff like '$'.
        def evaluate(scope)
            name = @name.safeevaluate(scope)
            value = @value.safeevaluate(scope)

            parsewrap do
                scope.setvar(name,value, @file, @line)
            end
        end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
puppet-0.24.2 lib/puppet/parser/ast/vardef.rb
puppet-0.24.3 lib/puppet/parser/ast/vardef.rb
puppet-0.24.4 lib/puppet/parser/ast/vardef.rb
puppet-0.24.5 lib/puppet/parser/ast/vardef.rb