Module: Puppet::Pops::PuppetStack

Defined in:
lib/puppet-debugserver/puppet_monkey_patches.rb

Class Method Summary collapse

Class Method Details

.stacktrace_from_backtrace(exception) ⇒ Object

This is very similar to the stacktrace function, but uses the exception backtrace instead of caller()



80
81
82
83
84
85
86
87
# File 'lib/puppet-debugserver/puppet_monkey_patches.rb', line 80

def self.stacktrace_from_backtrace(exception)
  exception.backtrace.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