lib/puppet/parser/ast/caseopt.rb in puppet-0.18.4 vs lib/puppet/parser/ast/caseopt.rb in puppet-0.22.4

- old
+ new

@@ -1,5 +1,7 @@ +require 'puppet/parser/ast/branch' + class Puppet::Parser::AST # Each individual option in a case statement. class CaseOpt < AST::Branch attr_accessor :value, :statements @@ -40,30 +42,21 @@ # You can specify a list of values; return each in turn. def eachvalue(scope) if @value.is_a?(AST::ASTArray) @value.each { |subval| - if scope - yield subval.evaluate(:scope => scope) - elsif subval.is_a? AST::Leaf - yield subval.value - end + yield subval.evaluate(:scope => scope) } else - if scope - yield @value.evaluate(:scope => scope) - elsif @value.is_a? AST::Leaf - yield @value.value - end + yield @value.evaluate(:scope => scope) end end # Evaluate the actual statements; this only gets called if # our option matched. def evaluate(hash) - scope = hash[:scope] - return @statements.safeevaluate(:scope => scope) + return @statements.safeevaluate(hash) end def tree(indent = 0) rettree = [ @value.tree(indent + 1), @@ -72,5 +65,7 @@ ] return rettree.flatten.join("\n") end end end + +# $Id: caseopt.rb 2259 2007-03-06 19:03:05Z luke $