Class: AppMap::Handler::Rails::Template::RenderHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/appmap/handler/rails/template.rb

Overview

Hooks the ActionView::Renderer method render. This method is used by Rails to perform template rendering. The TemplateCall event which is emitted by this handler has a path parameter, which is nil until it’s filled in by a ResolverHandler.

Class Method Summary collapse

Class Method Details

.handle_call(defined_class, hook_method, receiver, args) ⇒ Object



134
135
136
137
138
139
140
141
142
143
# File 'lib/appmap/handler/rails/template.rb', line 134

def handle_call(defined_class, hook_method, receiver, args)
  context, options = args

  warn "Renderer: #{options}" if LOG

  TemplateCall.new(receiver).tap do |call|
    Thread.current[TEMPLATE_RENDERER] ||= []
    Thread.current[TEMPLATE_RENDERER] << call
  end
end

.handle_return(call_event_id, elapsed, return_value, exception) ⇒ Object



145
146
147
148
149
# File 'lib/appmap/handler/rails/template.rb', line 145

def handle_return(call_event_id, elapsed, return_value, exception)
  Array(Thread.current[TEMPLATE_RENDERER]).pop

  AppMap::Event::MethodReturnIgnoreValue.build_from_invocation(call_event_id, elapsed: elapsed)
end