Module: AppMap::Handler

Defined in:
lib/appmap/handler.rb,
lib/appmap/handler/eval_handler.rb,
lib/appmap/handler/rails/context.rb,
lib/appmap/handler/rails/template.rb,
lib/appmap/handler/function_handler.rb,
lib/appmap/handler/net_http_handler.rb,
lib/appmap/handler/open_ssl_handler.rb,
lib/appmap/handler/rails/sql_handler.rb,
lib/appmap/handler/marshal_load_handler.rb,
lib/appmap/handler/rails/render_handler.rb,
lib/appmap/handler/rails/request_handler.rb

Overview

Specific hook handler classes and general related utilities.

Defined Under Namespace

Modules: Rails Classes: EvalHandler, FunctionHandler, HTTPClientRequest, HTTPClientResponse, MarshalLoadHandler, NetHTTPHandler, OpenSSLHandler

Constant Summary collapse

TEMPLATE_RENDER_FORMAT =
'appmap.handler.template.return_value_format'
TEMPLATE_RENDER_VALUE =
'appmap.handler.template.return_value'

Class Method Summary collapse

Class Method Details

.find(name) ⇒ Object

Try to find handler module with a given name.

If the module is not loaded, tries to require the appropriate file using the usual conventions, eg. ‘Acme::Handler::AppMap` will try to require `acme/handler/app_map`, then `acme/handler` and finally `acme`. Raises NameError if the module could not be loaded this way.



18
19
20
21
22
23
24
25
# File 'lib/appmap/handler.rb', line 18

def self.find(name)
  begin
    return Object.const_get name
  rescue NameError
    try_load ActiveSupport::Inflector.underscore name
  end
  Object.const_get name
end

.try_load(fname) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/appmap/handler.rb', line 27

def self.try_load(fname)
  fname = fname.sub %r{^app_map/}, 'appmap/'
  fname = fname.split '/'
  until fname.empty?
    begin
      require fname.join '/'
      return
    rescue LoadError
      # pass
    end
    fname.pop
  end
end