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



152
153
154
155
156
157
158
159
160
161
162
# File 'lib/appmap/handler/rails/template.rb', line 152

def handle_call(defined_class, hook_method, receiver, args)
  # context, options
  _, 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



164
165
166
167
168
169
# File 'lib/appmap/handler/rails/template.rb', line 164

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

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