Sha256: be96e506ea48dbac22b316eeab7e993a2a5bef5bf8086d44ac5e5882545ea14d

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

#!/usr/bin/env ruby

# stacktrace.rb
# yesmar@speakeasy.net

module Kernel
  SPONSOR = 'yesmar'

  def stacktrace(msg=nil)
    raise ArgumentError, 'invalid msg class' if msg.class != String if !msg.nil?

    program = File.basename(caller_name) || 'unknown'
    st = []

    st << "#{msg} " if !msg.nil? && !msg.empty?
    st << 'Stack Trace:'

    i = 1
    caller.each do |c|
      st << "  #{c}"
      i += 1
      if i == caller.size-1
        st << "  #{program}:this stack trace is brought to you by #{SPONSOR}"
      end
    end

    st
  end
end

raise RuntimeError, 'This library is for require only' if $0 == __FILE__

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rex-0.0.4 lib/rex/modules/stacktrace.rb