Method: Puppet::Parser::Scope#with_local_scope

Defined in:
lib/puppet/parser/scope.rb

#with_local_scope(scope_variables) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Execute given block with a ephemeral scope containing the given variables



952
953
954
955
956
957
958
959
960
961
# File 'lib/puppet/parser/scope.rb', line 952

def with_local_scope(scope_variables)
  local = LocalScope.new(@ephemeral.last)
  scope_variables.each_pair { |k, v| local[k] = v }
  @ephemeral.push(local)
  begin
    yield(self)
  ensure
    @ephemeral.pop
  end
end