Module: Puppet::Pops::PuppetStack Private
- Defined in:
- lib/puppet/pops/puppet_stack.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
will be represented with the text ‘unknown` and `0´ respectively.
Class Method Summary collapse
-
.stack(file, line, obj, message, args, &block) ⇒ Object
private
Sends a message to an obj such that it appears to come from file, line when calling stacktrace.
- .stacktrace ⇒ Object private
Class Method Details
.stack(file, line, obj, message, args, &block) ⇒ 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.
Sends a message to an obj such that it appears to come from file, line when calling stacktrace.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/puppet/pops/puppet_stack.rb', line 23 def self.stack(file, line, obj, , args, &block) file = '' if file.nil? line = 0 if line.nil? if block_given? Kernel.eval("obj.send(message, *args, &block)", Kernel.binding(), file, line) else Kernel.eval("obj.send(message, *args)", Kernel.binding(), file, line) end end |
.stacktrace ⇒ 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.
34 35 36 37 38 39 40 41 |
# File 'lib/puppet/pops/puppet_stack.rb', line 34 def self.stacktrace caller().reduce([]) do |memo, loc| if loc =~ /^(.*\.pp)?:([0-9]+):in (`stack'|`block in call_function')/ memo << [$1.nil? ? 'unknown' : $1, $2.to_i] end memo end end |