Sha256: 2bb35ca072a770537af57df107bcacdbb6a390d88d896e84c64c5a0d8966ba4b
Contents?: true
Size: 884 Bytes
Versions: 3
Compression:
Stored size: 884 Bytes
Contents
require 'ripl' module Ripl::Rc; end module Ripl::Rc::StripBacktrace include Ripl::Rc # makes U avaliable # strip backtrace until ripl def format_error e message, backtrace = get_error(e, U.strip_backtrace(e, @name)) "#{message}\n #{backtrace.join("\n ")}" end def get_error e, backtrace=e.backtrace ["#{e.class}: #{e.message}", backtrace] end module Imp def strip_backtrace e, name home(cwd(snip(e, name))) end def home b b.map{ |p| p.sub(ENV['HOME'], '~') } end def cwd b b.map{ |p| p.sub(Dir.pwd, '.') } end def snip e, name return [] if e.kind_of?(SyntaxError) e.backtrace[ 0.. e.backtrace.rindex{ |l| l =~ /\(#{name}\):\d+:in `.+?'/ } || -1] end end end module Ripl::Rc::U; extend Ripl::Rc::StripBacktrace::Imp; end Ripl::Shell.include(Ripl::Rc::StripBacktrace)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ripl-rc-0.1.5 | lib/ripl/rc/strip_backtrace.rb |
ripl-rc-0.1.4 | lib/ripl/rc/strip_backtrace.rb |
ripl-rc-0.1.3 | lib/ripl/rc/strip_backtrace.rb |