summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/not.rb
blob: 30fa6d5032b9123e31fe87396e8a826ddebbcd6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)
      ! Puppet::Parser::Scope.true?(val)
    end
  end
end