class StackifyRubyAPM::Normalizers::ActionView::RenderNormalizer

@api private

Private Instance Methods

gem_path(path) click to toggle source
# File lib/stackify_apm/normalizers/action_view.rb, line 28
def gem_path(path)
  root = Gem.path.find { |gp| path.start_with? gp }
  return unless root

  format '$GEM_PATH/%s', strip_root(root, path)
end
normalize_render(payload, type) click to toggle source
# File lib/stackify_apm/normalizers/action_view.rb, line 10
def normalize_render(payload, type)
  [path_for(payload[:identifier]), type, nil]
end
path_for(path) click to toggle source
# File lib/stackify_apm/normalizers/action_view.rb, line 14
def path_for(path)
  return 'Unknown template' unless path
  return path unless path.start_with?('/')

  view_path(path) || gem_path(path) || 'Absolute path'
end
strip_root(root, path) click to toggle source
# File lib/stackify_apm/normalizers/action_view.rb, line 35
def strip_root(root, path)
  start = root.length + 1
  path[start, path.length]
end
view_path(path) click to toggle source
# File lib/stackify_apm/normalizers/action_view.rb, line 21
def view_path(path)
  root = @config.view_paths.find { |vp| path.start_with?(vp) }
  return unless root

  strip_root(root, path)
end