Sha256: f11d400e284b6f4de09c536a89f954b6e63c281b0271e22fd8e044e4b468864f

Contents?: true

Size: 706 Bytes

Versions: 5

Compression:

Stored size: 706 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

5 entries across 5 versions & 1 rubygems

Version Path
activesupport-1.2.4 lib/active_support/core_ext/exception.rb
activesupport-1.2.5 lib/active_support/core_ext/exception.rb
activesupport-1.2.2 lib/active_support/core_ext/exception.rb
activesupport-1.2.1 lib/active_support/core_ext/exception.rb
activesupport-1.2.3 lib/active_support/core_ext/exception.rb