Class: Puppet::Parser::AST::BlockExpression

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

Overview

Evaluates contained expressions, produce result of the last

Constant Summary

Constants inherited from Puppet::Parser::AST

AST

Instance Attribute Summary

Attributes inherited from Branch

#children, #pin

Attributes inherited from Puppet::Parser::AST

#file, #line, #parent, #pos, #scope

Instance Method Summary collapse

Methods inherited from Branch

#each, #initialize

Methods inherited from Puppet::Parser::AST

#initialize, #inspect, #safeevaluate

Methods included from Util::Errors

#adderrorcontext, #devfail, #error_context, error_location, error_location_with_space, error_location_with_unknowns, #exceptwrap, #fail

Constructor Details

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

Instance Method Details

#evaluate(scope) ⇒ Object



6
7
8
# File 'lib/puppet/parser/ast/block_expression.rb', line 6

def evaluate(scope)
  @children.reduce(nil) { |_, child| child.safeevaluate(scope) }
end

#sequence_with(other) ⇒ Object



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

def sequence_with(other)
  Puppet::Parser::AST::BlockExpression.new(:children => children + other.children)
end

#to_sObject



14
15
16
# File 'lib/puppet/parser/ast/block_expression.rb', line 14

def to_s
  "[" + @children.collect(&:to_s).join(', ') + "]"
end