Class: RailsTracepointStack::Filter::GemPath
- Inherits:
-
Object
- Object
- RailsTracepointStack::Filter::GemPath
- Defined in:
- lib/rails_tracepoint_stack/filter/gem_path.rb
Class Method Summary collapse
- .bundled_gem_paths ⇒ Object
-
.full_gem_path ⇒ Object
Bundler gives the tightest answer, but it is not always there: a plain
ruby -eor an irb session against an installed gem has no bundle, and asking Bundler then raises instead of filtering. -
.gem_install_roots ⇒ Object
Without a bundle there is no resolved list to ask for, but everything installed lives under these roots, which is all the filter needs.
Class Method Details
.bundled_gem_paths ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rails_tracepoint_stack/filter/gem_path.rb', line 13 def self.bundled_gem_paths return nil unless defined?(::Bundler) ::Bundler.load.specs.map(&:full_gem_path) rescue nil end |
.full_gem_path ⇒ Object
Bundler gives the tightest answer, but it is not always there: a plain
ruby -e or an irb session against an installed gem has no bundle, and
asking Bundler then raises instead of filtering. Falling back to every
installed gem is wider than needed and still filters out the code the
developer did not write.
9 10 11 |
# File 'lib/rails_tracepoint_stack/filter/gem_path.rb', line 9 def self.full_gem_path @full_gem_path ||= bundled_gem_paths || gem_install_roots end |
.gem_install_roots ⇒ Object
Without a bundle there is no resolved list to ask for, but everything installed lives under these roots, which is all the filter needs.
23 24 25 |
# File 'lib/rails_tracepoint_stack/filter/gem_path.rb', line 23 def self.gem_install_roots Gem.path.map { |dir| File.join(dir, "gems") } end |