Sha256: ac470f2da3b1769f4af64434a554f8967323dc4b2040b9d021ef8822b5e1fe2a
Contents?: true
Size: 857 Bytes
Versions: 5
Compression:
Stored size: 857 Bytes
Contents
require 'puppet/parser/ast/branch' class Puppet::Parser::AST # A basic 'if/elsif/else' statement. class IfStatement < AST::Branch attr_accessor :test, :else, :statements def each [@test,@else,@statements].each { |child| yield child } end # Short-curcuit evaluation. If we're true, evaluate our statements, # else if there's an 'else' setting, evaluate it. # the first option that matches. def evaluate(scope) value = @test.safeevaluate(scope) if Puppet::Parser::Scope.true?(value) return @statements.safeevaluate(scope) else if defined? @else return @else.safeevaluate(scope) else return nil end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems