module DependencyDetection
This file is distributed under New Relic’s license terms. See github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
Public Instance Methods
defer(&block)
click to toggle source
# 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)
click to toggle source
# File lib/new_relic/dependency_detection.rb, line 34 def dependency_by_name(name) @items.find { |i| i.name == name } end
detect!()
click to toggle source
# 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