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

Inherits:
AppMap::Hook::Method 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.

Constant Summary

Constants inherited from AppMap::Hook::Method

AppMap::Hook::Method::HOOK_DISABLE_KEY

Constants included from AppMap::Hook::RecordAround

AppMap::Hook::RecordAround::APPMAP_OUTPUT_DIR

Instance Attribute Summary

Attributes inherited from AppMap::Hook::Method

#arity, #hook_class, #hook_method, #hook_package, #parameters, #record_around

Instance Method Summary collapse

Methods inherited from AppMap::Hook::Method

#activate, #call, #initialize

Methods included from AppMap::Hook::RecordAround

#record_around?, #record_around_after, #record_around_before

Constructor Details

This class inherits a constructor from AppMap::Hook::Method

Instance Method Details

#handle_call(receiver, args) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
# File 'lib/appmap/handler/rails/template.rb', line 159

def handle_call(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



171
172
173
174
175
176
# File 'lib/appmap/handler/rails/template.rb', line 171

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