blob: d7a362aa16261caa9f619a38efc4463a67cc0806 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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 Minus < AST::Branch
attr_accessor :value
def each
yield @value
end
def evaluate(scope)
val = @value.safeevaluate(scope)
val = Puppet::Parser::Scope.number?(val)
if val == nil
raise ArgumentError, "minus operand #{val} is not a number"
end
-val
end
end
end
|