Sha256: d101a4ba27f0c750f9e3e9612ced36f7cf320734e497fd46e3b08acc880d800c

Contents?: true

Size: 624 Bytes

Versions: 10

Compression:

Stored size: 624 Bytes

Contents

class Exception
  original_initialize = instance_method(:initialize)
  
  if BetterErrors.binding_of_caller_available?
    define_method :initialize do |*args|
      unless Thread.current[:__better_errors_exception_lock]
        Thread.current[:__better_errors_exception_lock] = true
        begin
          @__better_errors_bindings_stack = binding.callers.drop(1)
        ensure
          Thread.current[:__better_errors_exception_lock] = false
        end
      end
      original_initialize.bind(self).call(*args)
    end
  end
  
  def __better_errors_bindings_stack
    @__better_errors_bindings_stack || []
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
better_errors-0.8.0 lib/better_errors/core_ext/exception.rb
better_errors-0.7.2 lib/better_errors/core_ext/exception.rb
better_errors-0.7.0 lib/better_errors/core_ext/exception.rb
better_errors-0.6.0 lib/better_errors/core_ext/exception.rb
better_errors-0.5.0 lib/better_errors/core_ext/exception.rb
better_errors-0.3.2 lib/better_errors/core_ext/exception.rb
better_errors-0.3.0 lib/better_errors/core_ext/exception.rb
better_errors-0.2.0 lib/better_errors/core_ext/exception.rb
better_errors-0.1.1 lib/better_errors/core_ext/exception.rb
better_errors-0.1.0 lib/better_errors/core_ext/exception.rb