Module: Fiveruns::Tuneup::Instrumentation::ActionView::Base

Defined in:
lib/fiveruns/tuneup/instrumentation/action_view/base.rb

Defined Under Namespace

Modules: InstanceMethods

Constant Summary collapse

BASIC_TEMPLATE_PATH =
File.join(RAILS_ROOT, 'app', 'views')

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/fiveruns/tuneup/instrumentation/action_view/base.rb', line 9

def self.included(base)
  Fiveruns::Tuneup.instrument base, InstanceMethods
end

.normalize_path(path) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fiveruns/tuneup/instrumentation/action_view/base.rb', line 13

def self.normalize_path(path)
  return path unless path
  if path[0, BASIC_TEMPLATE_PATH.size] == BASIC_TEMPLATE_PATH
    path[(BASIC_TEMPLATE_PATH.size + 1)..-1]
  else
    if (components = path.split(File::SEPARATOR)).size > 2
      components[-2, 2].join(File::SEPARATOR)
    else
      components.join(File::SEPARATOR)
    end
  end
end