Class: Puppet::Parser::AST::Minus

Inherits:
Branch show all
Defined in:
lib/vendor/puppet/parser/ast/minus.rb

Constant Summary

Constants inherited from Puppet::Parser::AST

AST

Constants included from Util::Docs

Util::Docs::HEADER_LEVELS

Instance Attribute Summary collapse

Attributes inherited from Branch

#children, #pin

Attributes inherited from Puppet::Parser::AST

#file, #line, #parent, #scope

Attributes included from Util::Docs

#doc, #nodoc

Instance Method Summary collapse

Methods inherited from Branch

#initialize

Methods inherited from Puppet::Parser::AST

associates_doc, #evaluate_match, #initialize, #inspect, #parsefail, #parsewrap, #safeevaluate, settor?, #use_docs

Methods included from Util::Docs

#desc, #dochook, #doctable, #markdown_definitionlist, #markdown_header, #nodoc?, #pad, scrub

Methods included from Util::MethodHelper

#requiredopts, #set_options, #symbolize_options

Methods included from Util::Errors

#adderrorcontext, #devfail, #error_context, #exceptwrap, #fail

Constructor Details

This class inherits a constructor from Puppet::Parser::AST::Branch

Instance Attribute Details

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/vendor/puppet/parser/ast/minus.rb', line 8

def value
  @value
end

Instance Method Details

#each {|@value| ... } ⇒ Object

Yields:



10
11
12
# File 'lib/vendor/puppet/parser/ast/minus.rb', line 10

def each
  yield @value
end

#evaluate(scope) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/vendor/puppet/parser/ast/minus.rb', line 14

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