Module: RailsSpotlight::Utils
- Defined in:
- lib/rails_spotlight/utils.rb
Class Method Summary collapse
Class Method Details
.dev_callsite(caller) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rails_spotlight/utils.rb', line 7 def dev_callsite(caller) app_line = caller.detect { |c| c.start_with? RailsSpotlight.config.rails_root } return nil unless app_line _, filename, _, line, _, method = app_line.split(/^(.*?)(:(\d+))(:in `(.*)')?$/) { filename: sub_source_path(filename), line: line.to_i, method: method } rescue # rubocop:disable Style/RescueStandardError, Lint/SuppressedException end |
.sub_source_path(path) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rails_spotlight/utils.rb', line 21 def sub_source_path(path) rails_root = RailsSpotlight.config.rails_root source_path = RailsSpotlight.config.source_path return path if rails_root == source_path path.sub(rails_root, source_path) end |