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

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

Instance Method Summary collapse

Instance Method Details

#render_file_with_fiveruns_tuneup(path, *args, &block) ⇒ Object



27
28
29
30
31
32
# File 'lib/fiveruns/tuneup/instrumentation/action_view/base.rb', line 27

def render_file_with_fiveruns_tuneup(path, *args, &block)
  name = Fiveruns::Tuneup::Instrumentation::ActionView::Base.normalize_path(path)
  Fiveruns::Tuneup.step "Render file #{name}", :view do
    render_file_without_fiveruns_tuneup(path, *args, &block)
  end
end

#render_with_fiveruns_tuneup(*args, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/fiveruns/tuneup/instrumentation/action_view/base.rb', line 40

def render_with_fiveruns_tuneup(*args, &block)
  record = true
  options = args.first || {}
  path = case options
  when String
    # Pre-Rails 2.1, don't record this as it causes duplicate records 
    if Fiveruns::Tuneup::Version.rails < Fiveruns::Tuneup::Version.new(2,1,0)
      record = false
    else
      "Render #{options}"                  
    end
  when :update
    name = block.to_s.split('/').last.split(':').first rescue ''
    "Render page update #{name}"
  when Hash
    if options[:file]
      "Render #{options[:file]}"
    elsif options[:partial]
      record = false
    elsif options[:inline]
      "Render inline"
    elsif options[:text]
      "Render text"
    end
  end
  path ||= 'Render'
  
  if record
    Fiveruns::Tuneup.step path, :view do
      render_without_fiveruns_tuneup(*args, &block)
    end
  else
    render_without_fiveruns_tuneup(*args, &block)
  end
end

#update_page_with_fiveruns_tuneup(*args, &block) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/fiveruns/tuneup/instrumentation/action_view/base.rb', line 33

def update_page_with_fiveruns_tuneup(*args, &block)
  path = block.to_s.split('/').last.split(':').first rescue ''
  name = Fiveruns::Tuneup::Instrumentation::ActionView::Base.normalize_path(path)
  Fiveruns::Tuneup.step "Render page update #{name}", :view do
    update_page_without_fiveruns_tuneup(*args, &block)
  end
end