Sha256: 9c78fa71b818a2e10c150844c617be2999763d416ea3fc6ecfb82d5b142707a2
Contents?: true
Size: 686 Bytes
Versions: 6
Compression:
Stored size: 686 Bytes
Contents
# frozen_string_literal: true module RailsSpotlight module Utils module_function 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 } end 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 end end
Version data entries
6 entries across 6 versions & 1 rubygems