summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-07-20 13:31:34 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-07-20 13:31:34 -0700
commit94edd404130b4236f0c65a579857e3a25c5ee17f (patch)
treeefbdb3b3f64d1e362b3c8c78c352a9340e914361 /lib/puppet/parser/ast.rb
parent2af27160b94efa4755187efd99c86d1659683b29 (diff)
parentdb0b30dbde94d16ab1d7580be4dd32e18cff23dc (diff)
downloadpuppet-94edd404130b4236f0c65a579857e3a25c5ee17f.tar.gz
puppet-94edd404130b4236f0c65a579857e3a25c5ee17f.tar.xz
puppet-94edd404130b4236f0c65a579857e3a25c5ee17f.zip
Merge commit 'tags/2.6.0' into next
Diffstat (limited to 'lib/puppet/parser/ast.rb')
-rw-r--r--lib/puppet/parser/ast.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index 2773a240e..54e034acb 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -87,6 +87,20 @@ class Puppet::Parser::AST
def initialize(args)
set_options(args)
end
+
+ # evaluate ourselves, and match
+ def evaluate_match(value, scope)
+ obj = self.safeevaluate(scope)
+
+ obj = obj.downcase if obj.respond_to?(:downcase)
+ value = value.downcase if value.respond_to?(:downcase)
+
+ obj = Puppet::Parser::Scope.number?(obj) || obj
+ value = Puppet::Parser::Scope.number?(value) || value
+
+ # "" == undef for case/selector/if
+ obj == value or (obj == "" and value == :undef)
+ end
end
# And include all of the AST subclasses.