Sha256: 0bfa86cc5a79ca5f219672507cb22c4421c38feec4aa5100c3feef200d733a99

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

class Exception
  alias :clean_message :message
  
  TraceSubstitutions = []
  FrameworkRegexp = /generated_code|vendor|dispatch|ruby|script\/\w+/
  
  def clean_backtrace
    backtrace.collect do |line|
      TraceSubstitutions.inject(line) do |line, (regexp, sub)|
        line.gsub regexp, sub
      end
    end
  end
  
  def application_backtrace
    before_application_frame = true
    
    clean_backtrace.reject do |line|
      non_app_frame = !! (line =~ FrameworkRegexp)
      before_application_frame = false unless non_app_frame
      non_app_frame && ! before_application_frame
    end
  end
  
  def framework_backtrace
    clean_backtrace.select {|line| line =~ FrameworkRegexp}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activesupport-1.3.0 lib/active_support/core_ext/exception.rb