Method: Spring::Application#shush_backtraces

Defined in:
lib/spring/application.rb

#shush_backtracesObject

This feels very naughty



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/spring/application.rb', line 259

def shush_backtraces
  Kernel.module_eval do
    old_raise = Kernel.method(:raise)
    remove_method :raise
    define_method :raise do |*args|
      begin
        old_raise.call(*args)
      ensure
        if $!
          lib = File.expand_path("..", __FILE__)
          $!.backtrace.reject! { |line| line.start_with?(lib) }
        end
      end
    end
    private :raise
  end
end