Module: DependencyDetection
- Defined in:
- lib/new_relic/dependency_detection.rb
Overview
This file is distributed under New Relic’s license terms. See github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. frozen_string_literal: true
Defined Under Namespace
Classes: Dependent
Class Method Summary collapse
Class Method Details
.defer(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/new_relic/dependency_detection.rb', line 10 def defer(&block) item = Dependent.new item.instance_eval(&block) if item.name seen_names = @items.map { |i| i.name }.compact if seen_names.include?(item.name) NewRelic::Agent.logger.warn("Refusing to re-register DependencyDetection block with name '#{item.name}'") return @items end end @items << item return item end |
.dependency_by_name(name) ⇒ Object
34 35 36 |
# File 'lib/new_relic/dependency_detection.rb', line 34 def dependency_by_name(name) @items.find { |i| i.name == name } end |
.detect! ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/new_relic/dependency_detection.rb', line 26 def detect! @items.each do |item| next if item.executed || item.disabled_configured? item.dependencies_satisfied? ? item.execute : item.configure_as_unsatisfied end end |