Module: Bulldogger::ApplicationFrames
- Defined in:
- lib/bulldogger/application_frames.rb
Overview
Classifies frames by their source path for replay and failure guidance. It does not decide whether replay is enabled or permitted.
Class Method Summary collapse
Class Method Details
.available?(test_file, frames) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bulldogger/application_frames.rb', line 11 def available?(test_file, frames) return false unless test_file && frames.respond_to?(:any?) test_path = File.(test_file) # A gem can raise while an application caller remains on the stack. # That caller can hold the values, so classification checks every frame. frames.any? do |frame| raw_path = frame["path"].to_s next false if raw_path.empty? path = File.(raw_path) path != test_path && !library_path?(path) end end |
.library_path?(path) ⇒ Boolean
26 27 28 |
# File 'lib/bulldogger/application_frames.rb', line 26 def library_path?(path) library_paths.any? { |prefix| path.start_with?(prefix) } end |
.library_paths ⇒ Object
30 31 32 33 34 |
# File 'lib/bulldogger/application_frames.rb', line 30 def library_paths # A vendored bundle can sit inside the project directory. Gem.path still # identifies it, so project-directory classification would be incorrect. Gem.path + RbConfig::CONFIG.values_at("rubylibdir", "sitelibdir").compact end |