module Rib::StripBacktrace
Public Instance Methods
format_backtrace(backtrace)
click to toggle source
Calls superclass method
# File lib/rib/core/strip_backtrace.rb, line 22 def format_backtrace backtrace return super if StripBacktrace.disabled? strip_home_backtrace( strip_cwd_backtrace( strip_rib_backtrace(super(backtrace)))) end
format_error(err)
click to toggle source
get_error(err)
click to toggle source
Calls superclass method
# File lib/rib/core/strip_backtrace.rb, line 16 def get_error err return super if StripBacktrace.disabled? ["#{err.class}: #{err.message}", format_backtrace(err.backtrace)] end
replace_path_prefix(prefix, substitute, path)
click to toggle source
# File lib/rib/core/strip_backtrace.rb, line 42 def replace_path_prefix prefix, substitute, path path.sub(/\A#{Regexp.escape(prefix)}\//, substitute) end
strip_cwd_backtrace(backtrace)
click to toggle source
# File lib/rib/core/strip_backtrace.rb, line 33 def strip_cwd_backtrace backtrace backtrace.map(&method(:replace_path_prefix).curry[Dir.pwd, '']) end
strip_home_backtrace(backtrace)
click to toggle source
# File lib/rib/core/strip_backtrace.rb, line 29 def strip_home_backtrace backtrace backtrace.map(&method(:replace_path_prefix).curry[ENV['HOME'], '~/']) end
strip_rib_backtrace(backtrace)
click to toggle source
# File lib/rib/core/strip_backtrace.rb, line 37 def strip_rib_backtrace backtrace backtrace[ 0..backtrace.rindex{ |l| l =~ /\(#{name}\):\d+:in `.+?'/ } || -1] end