Sha256: 3aa7adbda592fea84e1afccf223a2ca0dd524f063a82676a3009351ecab78c89
Contents?: true
Size: 919 Bytes
Versions: 2
Compression:
Stored size: 919 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(hash) scope = hash[:scope] value = @test.safeevaluate(:scope => scope) if Puppet::Parser::Scope.true?(value) return @statements.safeevaluate(:scope => scope) else if defined? @else return @else.safeevaluate(:scope => scope) else return nil end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puppet-0.24.0 | lib/puppet/parser/ast/ifstatement.rb |
puppet-0.24.1 | lib/puppet/parser/ast/ifstatement.rb |