class Atatus::Normalizers::ActionView::RenderNormalizer

@api private

Private Instance Methods

gem_path(path) click to toggle source
# File lib/atatus/normalizers/rails/action_view.rb, line 45
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, subtype, action) click to toggle source
# File lib/atatus/normalizers/rails/action_view.rb, line 27
def normalize_render(payload, type, subtype, action)
  [path_for(payload[:identifier]), type, subtype, action, nil]
end
path_for(path) click to toggle source
# File lib/atatus/normalizers/rails/action_view.rb, line 31
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/atatus/normalizers/rails/action_view.rb, line 52
def strip_root(root, path)
  start = root.length + 1
  path[start, path.length]
end
view_path(path) click to toggle source
# File lib/atatus/normalizers/rails/action_view.rb, line 38
def view_path(path)
  root = @config.__view_paths.find { |vp| path.start_with?(vp) }
  return unless root

  strip_root(root, path)
end