Module: FailtaleReporter::BacktraceCleaner
- Included in:
- FailtaleReporter
- Defined in:
- lib/failtale_reporter/backtrace_cleaner.rb
Instance Method Summary collapse
- #backtrace_cleaner(&block) ⇒ Object
- #backtrace_cleaner_regexp(path) ⇒ Object
- #backtrace_cleaners ⇒ Object
- #clean_backtrace(backtrace) ⇒ Object
Instance Method Details
#backtrace_cleaner(&block) ⇒ Object
24 25 26 |
# File 'lib/failtale_reporter/backtrace_cleaner.rb', line 24 def backtrace_cleaner(&block) backtrace_cleaners.push(block) end |
#backtrace_cleaner_regexp(path) ⇒ Object
28 29 30 |
# File 'lib/failtale_reporter/backtrace_cleaner.rb', line 28 def backtrace_cleaner_regexp(path) Regexp.new("^#{Regexp.escape(File.(path))}") end |
#backtrace_cleaners ⇒ Object
20 21 22 |
# File 'lib/failtale_reporter/backtrace_cleaner.rb', line 20 def backtrace_cleaners @backtrace_cleaners ||= [] end |
#clean_backtrace(backtrace) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/failtale_reporter/backtrace_cleaner.rb', line 3 def clean_backtrace(backtrace) backtrace.collect do |line| path = File.(line.split(':').first) if File.exist?(path) line = File.(line) cleaned_line = nil backtrace_cleaners.each do |proc| cleaned_line = proc.call(line) break if cleaned_line end cleaned_line || line else line end end end |