summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/ast.rb1
-rw-r--r--lib/puppet/parser/ast/not.rb19
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index da82a30c7..572771201 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -89,6 +89,7 @@ require 'puppet/parser/ast/hostclass'
require 'puppet/parser/ast/ifstatement'
require 'puppet/parser/ast/leaf'
require 'puppet/parser/ast/node'
+require 'puppet/parser/ast/not'
require 'puppet/parser/ast/resource'
require 'puppet/parser/ast/resource_defaults'
require 'puppet/parser/ast/resource_override'
diff --git a/lib/puppet/parser/ast/not.rb b/lib/puppet/parser/ast/not.rb
new file mode 100644
index 000000000..c8fa1df2c
--- /dev/null
+++ b/lib/puppet/parser/ast/not.rb
@@ -0,0 +1,19 @@
+require 'puppet'
+require 'puppet/parser/ast/branch'
+
+# An object that returns a boolean which is the boolean not
+# of the given value.
+class Puppet::Parser::AST
+ class Not < AST::Branch
+ attr_accessor :value
+
+ def each
+ yield @value
+ end
+
+ def evaluate(scope)
+ val = @value.safeevaluate(scope)
+ return ! Puppet::Parser::Scope.true?(val)
+ end
+ end
+end