Module: Skylight::Probes Private
- Defined in:
- lib/skylight/probes.rb,
lib/skylight/probes/tilt.rb,
lib/skylight/probes/excon.rb,
lib/skylight/probes/redis.rb,
lib/skylight/probes/sequel.rb,
lib/skylight/probes/sinatra.rb,
lib/skylight/probes/net_http.rb,
lib/skylight/probes/excon/middleware.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Excon, NetHTTP, Redis, Sequel, Sinatra, Tilt Classes: ProbeRegistration
Class Method Summary collapse
- .installed ⇒ Object private
- .is_available?(klass_name) ⇒ Boolean private
- .lookup_by_require_path(require_path) ⇒ Object private
- .register(*args) ⇒ Object private
- .register_require_hook(registration) ⇒ Object private
- .require_hook(require_path) ⇒ Object private
- .require_hooks ⇒ Object private
- .unregister_require_hook(registration) ⇒ Object private
Class Method Details
.installed ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/skylight/probes.rb', line 22 def self.installed @installed ||= {} end |
.is_available?(klass_name) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/skylight/probes.rb', line 26 def self.is_available?(klass_name) !!Skylight::Util::Inflector.safe_constantize(klass_name) end |
.lookup_by_require_path(require_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 |
# File 'lib/skylight/probes.rb', line 69 def self.lookup_by_require_path(require_path) require_hooks[require_path] end |
.register(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/skylight/probes.rb', line 30 def self.register(*args) registration = ProbeRegistration.new(*args) if is_available?(registration.klass_name) installed[registration.klass_name] = registration registration.install else register_require_hook(registration) end end |
.register_require_hook(registration) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 60 61 |
# File 'lib/skylight/probes.rb', line 57 def self.register_require_hook(registration) registration.require_paths.each do |p| require_hooks[p] = registration end end |
.require_hook(require_path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/skylight/probes.rb', line 41 def self.require_hook(require_path) return unless Skylight.native? registration = lookup_by_require_path(require_path) return unless registration # Double check constant is available if is_available?(registration.klass_name) installed[registration.klass_name] = registration registration.install # Don't need this to be called again unregister_require_hook(registration) end end |
.require_hooks ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/skylight/probes.rb', line 18 def self.require_hooks @require_hooks ||= {} end |
.unregister_require_hook(registration) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 66 67 |
# File 'lib/skylight/probes.rb', line 63 def self.unregister_require_hook(registration) registration.require_paths.each do |p| require_hooks.delete(p) end end |