Module: Mnemosyne::Probes

Defined in:
lib/mnemosyne.rb,
lib/mnemosyne/probes.rb,
lib/mnemosyne/probes/acfs/request.rb,
lib/mnemosyne/probes/restify/base.rb,
lib/mnemosyne/probes/mnemosyne/tracer.rb,
lib/mnemosyne/probes/responder/respond.rb,
lib/mnemosyne/probes/grape/endpoint_run.rb,
lib/mnemosyne/probes/active_record/query.rb,
lib/mnemosyne/probes/grape/endpoint_render.rb,
lib/mnemosyne/probes/action_view/render_partial.rb,
lib/mnemosyne/probes/grape/endpoint_run_filters.rb,
lib/mnemosyne/probes/action_controller/renderers.rb,
lib/mnemosyne/probes/action_view/render_template.rb,
lib/mnemosyne/probes/action_controller/process_action.rb

Defined Under Namespace

Modules: Acfs, ActionController, ActionView, ActiveRecord, Grape, Mnemosyne, Responder, Restify Classes: Registration

Class Method Summary collapse

Class Method Details

.class_available?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/mnemosyne/probes.rb', line 27

def class_available?(class_name)
  Module.const_get(class_name).is_a? Class
rescue NameError
  false
end

.register(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/mnemosyne/probes.rb', line 33

def register(*args)
  registration = Registration.new(*args)

  if registration.installable?
    registration.install
  else
    register_require_hook registration
  end
end

.register_require_hook(registration) ⇒ Object



53
54
55
56
57
# File 'lib/mnemosyne/probes.rb', line 53

def register_require_hook(registration)
  registration.require_paths.each do |path|
    require_hooks[path] = registration
  end
end

.require_hook(name) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/mnemosyne/probes.rb', line 43

def require_hook(name)
  registration = require_hooks[name]
  return unless registration
  return unless registration.installable?

  registration.install

  unregister_require_hook registration
end

.unregister_require_hook(registration) ⇒ Object



59
60
61
62
63
# File 'lib/mnemosyne/probes.rb', line 59

def unregister_require_hook(registration)
  registration.require_paths.each do |path|
    require_hooks.delete path
  end
end