Module: AppMap::Handler
- Defined in:
- lib/appmap/handler.rb,
lib/appmap/handler/function.rb,
lib/appmap/handler/net_http.rb,
lib/appmap/handler/rails/template.rb,
lib/appmap/handler/rails/sql_handler.rb,
lib/appmap/handler/rails/request_handler.rb
Overview
Specific hook handler classes and general related utilities.
Defined Under Namespace
Modules: Function, Rails Classes: HTTPClientRequest, HTTPClientResponse, NetHTTP
Class Method Summary collapse
-
.find(name) ⇒ Object
Try to find handler module with a given name.
- .try_load(fname) ⇒ Object
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.
15 16 17 18 19 20 21 22 |
# File 'lib/appmap/handler.rb', line 15 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
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/appmap/handler.rb', line 24 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 |