Class: RorVsWild::Plugin::ActionView

Inherits:
Object
  • Object
show all
Defined in:
lib/rorvswild/plugin/action_view.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.setup(agent) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rorvswild/plugin/action_view.rb', line 8

def self.setup(agent)
  return if @installed
  return unless defined?(ActiveSupport::Notifications.subscribe)
  ActiveSupport::Notifications.subscribe("render_partial.action_view", plugin = new)
  ActiveSupport::Notifications.subscribe("render_template.action_view", plugin)
  ActiveSupport::Notifications.subscribe("render_collection.action_view", plugin)
  @installed = true
end

Instance Method Details

#finish(name, id, payload) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rorvswild/plugin/action_view.rb', line 23

def finish(name, id, payload)
  return if !payload[:identifier]
  return if payload[:count] == 0 # render empty collection
  RorVsWild::Section.stop do |section|
    section.kind = "view"
    section.commands << RorVsWild.agent.locator.relative_path(payload[:identifier])
    section.file = section.command
    section.line = 0
    section.calls = payload[:count] if payload[:count] # render collection
  end
end

#start(name, id, payload) ⇒ Object



17
18
19
20
21
# File 'lib/rorvswild/plugin/action_view.rb', line 17

def start(name, id, payload)
  return if !payload[:identifier]
  return if payload[:count] == 0 # render empty collection
  RorVsWild::Section.start
end